Force pro2cmake.py to always change the dir to the converted pro file
Otherwise if you call the script from a different directory, path handling becomes broken and certain files are not found. Change-Id: Ia2f60abbd312a771330b3d5e928e1ccd0b4a845b Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
parent
cc141cc5c6
commit
aed2c1f5ae
@ -1566,8 +1566,14 @@ def main() -> None:
|
|||||||
|
|
||||||
debug_parsing = args.debug_parser or args.debug
|
debug_parsing = args.debug_parser or args.debug
|
||||||
|
|
||||||
|
backup_current_dir = os.getcwd()
|
||||||
|
|
||||||
for file in args.files:
|
for file in args.files:
|
||||||
parseresult = parseProFile(file, debug=debug_parsing)
|
new_current_dir = os.path.dirname(file)
|
||||||
|
file_relative_path = os.path.basename(file)
|
||||||
|
os.chdir(new_current_dir)
|
||||||
|
|
||||||
|
parseresult = parseProFile(file_relative_path, debug=debug_parsing)
|
||||||
|
|
||||||
if args.debug_parse_result or args.debug:
|
if args.debug_parse_result or args.debug:
|
||||||
print('\n\n#### Parser result:')
|
print('\n\n#### Parser result:')
|
||||||
@ -1578,7 +1584,7 @@ def main() -> None:
|
|||||||
print(parseresult.asDict())
|
print(parseresult.asDict())
|
||||||
print('\n#### End of parser result dictionary.\n')
|
print('\n#### End of parser result dictionary.\n')
|
||||||
|
|
||||||
file_scope = Scope.FromDict(None, file,
|
file_scope = Scope.FromDict(None, file_relative_path,
|
||||||
parseresult.asDict().get('statements'))
|
parseresult.asDict().get('statements'))
|
||||||
|
|
||||||
if args.debug_pro_structure or args.debug:
|
if args.debug_pro_structure or args.debug:
|
||||||
@ -1594,6 +1600,7 @@ def main() -> None:
|
|||||||
print('\n#### End of full .pro/.pri file structure.\n')
|
print('\n#### End of full .pro/.pri file structure.\n')
|
||||||
|
|
||||||
generate_cmakelists(file_scope)
|
generate_cmakelists(file_scope)
|
||||||
|
os.chdir(backup_current_dir)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user