mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
mesa: correctly use os.path.join in our python scripts
With Windows in mind, using forward slash isn't the right thing to do. Even if it just works, we might want to fix it. As here, use __file__ instead of argv[0] and sys.path.insert over sys.path.append. With the path tweak being reportedly faster. Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
This commit is contained in:
parent
9cc8e12505
commit
ca152234e1
2 changed files with 5 additions and 6 deletions
|
|
@ -29,8 +29,8 @@ from __future__ import print_function
|
|||
import sys
|
||||
# make it possible to import glapi
|
||||
import os
|
||||
GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "glapi/gen")
|
||||
sys.path.append(GLAPI)
|
||||
GLAPI = os.path.join(".", os.path.dirname(__file__), "glapi", "gen")
|
||||
sys.path.insert(0, GLAPI)
|
||||
|
||||
from operator import attrgetter
|
||||
import re
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ import os, sys, getopt
|
|||
from collections import defaultdict
|
||||
import get_hash_params
|
||||
|
||||
cur_dir = os.path.dirname(sys.argv[0])
|
||||
param_desc_file = "%s/get_hash_params.py" % cur_dir
|
||||
param_desc_file = os.path.join(os.path.dirname(__file__), "get_hash_params.py")
|
||||
|
||||
GLAPI = "%s/../../mapi/glapi/gen" % cur_dir
|
||||
sys.path.append(GLAPI)
|
||||
GLAPI = os.path.join(os.path.dirname(__file__), "..", "..", "mapi", "glapi", "gen")
|
||||
sys.path.insert(0, GLAPI)
|
||||
import gl_XML
|
||||
|
||||
prime_factor = 89
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue