Fix some working with paths in prepare.py
Use os.path.join for separator Get real path of Libraries/ThirdParty directories to workaround gyp's problems with drive letters
This commit is contained in:
parent
ae43e78a86
commit
3d8742fa7c
|
@ -25,15 +25,14 @@ if win and not win32 and not win64:
|
||||||
|
|
||||||
os.chdir(scriptPath + '/../../../..')
|
os.chdir(scriptPath + '/../../../..')
|
||||||
|
|
||||||
dirSep = '\\' if win else '/'
|
|
||||||
pathSep = ';' if win else ':'
|
pathSep = ';' if win else ':'
|
||||||
libsLoc = 'Libraries' if not win64 else ('Libraries' + dirSep + 'win64')
|
libsLoc = 'Libraries' if not win64 else (os.path.join('Libraries', 'win64'))
|
||||||
keysLoc = 'cache_keys'
|
keysLoc = 'cache_keys'
|
||||||
|
|
||||||
rootDir = os.getcwd()
|
rootDir = os.getcwd()
|
||||||
libsDir = rootDir + dirSep + libsLoc
|
libsDir = os.path.realpath(os.path.join(rootDir, libsLoc))
|
||||||
thirdPartyDir = rootDir + dirSep + 'ThirdParty'
|
thirdPartyDir = os.path.realpath(os.path.join(rootDir, 'ThirdParty'))
|
||||||
usedPrefix = libsDir + dirSep + 'local'
|
usedPrefix = os.path.realpath(os.path.join(libsDir, 'local'))
|
||||||
|
|
||||||
optionsList = [
|
optionsList = [
|
||||||
'skip-release',
|
'skip-release',
|
||||||
|
@ -56,10 +55,10 @@ for arg in sys.argv[1:]:
|
||||||
buildQt5 = not 'skip-qt5' in options if win else 'build-qt5' in options
|
buildQt5 = not 'skip-qt5' in options if win else 'build-qt5' in options
|
||||||
buildQt6 = 'build-qt6' in options if win else not 'skip-qt6' in options
|
buildQt6 = 'build-qt6' in options if win else not 'skip-qt6' in options
|
||||||
|
|
||||||
if not os.path.isdir(libsDir + '/' + keysLoc):
|
if not os.path.isdir(os.path.join(libsDir, keysLoc)):
|
||||||
pathlib.Path(libsDir + '/' + keysLoc).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(os.path.join(libsDir, keysLoc)).mkdir(parents=True, exist_ok=True)
|
||||||
if not os.path.isdir(thirdPartyDir + '/' + keysLoc):
|
if not os.path.isdir(os.path.join(thirdPartyDir, keysLoc)):
|
||||||
pathlib.Path(thirdPartyDir + '/' + keysLoc).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(os.path.join(thirdPartyDir, keysLoc)).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
pathPrefixes = [
|
pathPrefixes = [
|
||||||
'ThirdParty\\Strawberry\\perl\\bin',
|
'ThirdParty\\Strawberry\\perl\\bin',
|
||||||
|
@ -76,7 +75,7 @@ pathPrefixes = [
|
||||||
]
|
]
|
||||||
pathPrefix = ''
|
pathPrefix = ''
|
||||||
for singlePrefix in pathPrefixes:
|
for singlePrefix in pathPrefixes:
|
||||||
pathPrefix = pathPrefix + rootDir + dirSep + singlePrefix + pathSep
|
pathPrefix = pathPrefix + os.path.join(rootDir, singlePrefix) + pathSep
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
'MAKE_THREADS_CNT': '-j8',
|
'MAKE_THREADS_CNT': '-j8',
|
||||||
|
@ -138,10 +137,10 @@ def computeCacheKey(stage):
|
||||||
stage['commands']
|
stage['commands']
|
||||||
]
|
]
|
||||||
for pattern in stage['dependencies']:
|
for pattern in stage['dependencies']:
|
||||||
pathlist = glob.glob(libsDir + '/' + pattern)
|
pathlist = glob.glob(os.path.join(libsDir, pattern))
|
||||||
items = [pattern]
|
items = [pattern]
|
||||||
if len(pathlist) == 0:
|
if len(pathlist) == 0:
|
||||||
pathlist = glob.glob(thirdPartyDir + '/' + pattern)
|
pathlist = glob.glob(os.path.join(thirdPartyDir, pattern))
|
||||||
if len(pathlist) == 0:
|
if len(pathlist) == 0:
|
||||||
error('Nothing found: ' + pattern)
|
error('Nothing found: ' + pattern)
|
||||||
for path in pathlist:
|
for path in pathlist:
|
||||||
|
@ -152,13 +151,13 @@ def computeCacheKey(stage):
|
||||||
return hashlib.sha1(';'.join(objects).encode('utf-8')).hexdigest()
|
return hashlib.sha1(';'.join(objects).encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
def keyPath(stage):
|
def keyPath(stage):
|
||||||
return stage['directory'] + '/' + keysLoc + '/' + stage['name']
|
return os.path.join(stage['directory'], keysLoc, stage['name'])
|
||||||
|
|
||||||
def checkCacheKey(stage):
|
def checkCacheKey(stage):
|
||||||
if not 'key' in stage:
|
if not 'key' in stage:
|
||||||
error('Key not set in stage: ' + stage['name'])
|
error('Key not set in stage: ' + stage['name'])
|
||||||
key = keyPath(stage)
|
key = keyPath(stage)
|
||||||
if not os.path.exists(stage['directory'] + '/' + stage['name']):
|
if not os.path.exists(os.path.join(stage['directory'], stage['name'])):
|
||||||
return 'NotFound'
|
return 'NotFound'
|
||||||
if not os.path.exists(key):
|
if not os.path.exists(key):
|
||||||
return 'Stale'
|
return 'Stale'
|
||||||
|
@ -341,7 +340,7 @@ def runStages():
|
||||||
continue
|
continue
|
||||||
index = index + 1
|
index = index + 1
|
||||||
version = ('#' + str(stage['version'])) if (stage['version'] != '0') else ''
|
version = ('#' + str(stage['version'])) if (stage['version'] != '0') else ''
|
||||||
prefix = '[' + str(index) + '/' + str(count) + '](' + stage['location'] + '/' + stage['name'] + version + ')'
|
prefix = '[' + os.path.join(str(index), str(count)) + '](' + os.path.join(stage['location'], stage['name']) + version + ')'
|
||||||
print(prefix + ': ', end = '', flush=True)
|
print(prefix + ': ', end = '', flush=True)
|
||||||
stage['key'] = computeCacheKey(stage)
|
stage['key'] = computeCacheKey(stage)
|
||||||
commands = removeDir(stage['name']) + '\n' + stage['commands']
|
commands = removeDir(stage['name']) + '\n' + stage['commands']
|
||||||
|
|
Loading…
Reference in New Issue