Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2017-03-19 17:41:53 +0300
committerMikkel Krautz <mikkel@krautz.dk>2017-03-19 17:41:53 +0300
commitac674d932e2ebedabd2f300be1d136946246a85a (patch)
tree61414da1879d6af5ad29dd405b3aa2485372b19a /scripts/rcc-depends.py
parent3313f9b5c5a7842a580eff0c8a7e0aa439158d8a (diff)
scripts/rcc-depends.py: fall back to using the absolute path when os.path.relpath() fails on Windows.
On Windows, it is not always possible to create a relative path from an absolute path. For example, if Qt lives on C:, and Mumble is being built on Z:. Things will fall apart then, because we include some of Qt's translations in our .qrc files. This commit works around that issue by falling back to absolute paths when finding a relative path fails.
Diffstat (limited to 'scripts/rcc-depends.py')
-rwxr-xr-xscripts/rcc-depends.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/rcc-depends.py b/scripts/rcc-depends.py
index 926cf0d36..5990fe393 100755
--- a/scripts/rcc-depends.py
+++ b/scripts/rcc-depends.py
@@ -28,10 +28,18 @@ def main():
for fileTag in fileTags:
textNode = fileTag.childNodes[0].wholeText
absPath = os.path.normpath(os.path.join(fnDir, textNode))
- relPath = os.path.relpath(absPath)
- output = relPath
if platform.system() == 'Windows':
+ try:
+ output = os.path.relpath(absPath)
+ except ValueError:
+ # In some cases, Qt lives on another drive than Mumble.
+ # This means that we can't create relative path from
+ # our absolute path.
+ # In those cases, use the absolute path instead.
+ output = absPath
output = output.replace('\\', '/')
+ else:
+ output = os.path.relpath(absPath)
print(output)
if __name__ == '__main__':