aboutsummaryrefslogtreecommitdiffstats
path: root/packaging-tools/bld_module.py
Commit message (Collapse)AuthorAgeFilesLines
* PL119: os.path.basename("foo/bar") should be replaced by bar_path.namePatrik Teivonen2023-01-131-5/+5
| | | | | | | | | Get basename of a path using pathlib.Path.name. Enable PL119 in flake8. Update copyright year for changed files. Change-Id: Ice7cd7e9246950dd39321b108bb68c9466f62189 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Refactor runner.py functionsPatrik Teivonen2022-11-011-3/+2
| | | | | | | | | Rewrite runner.py Follow up patch: run_command from bld_utils.py Requires following patch in 6cc08ee72a7eb1860bb2f982879ff71c6dda2e10 Change-Id: I984046f56d4faac8ac58f12d0dad07d7bae4b0a2 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Revert "Revert "Use logging functions from logging_util.py""Antti Kokko2022-10-261-10/+19
| | | | | | | | | | This reverts commit 64b709d4b422e6d59f9e703fbc1124dd3f77d556. Reason for revert: required dependent changes are done, we can bring this change back Change-Id: I1692b433eda3fd2a1e5aa541785dae942cbd1665 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* Revert "Use logging functions from logging_util.py"Antti Kokko2022-10-191-19/+10
| | | | | | | | | This reverts commit bd38f3c2897c3f82f8c10464f70ed301c618dae7. Reason for revert: temporarily revert due to colorlog import issues Change-Id: I8e47743780c8998580ca40de56cbe0d0b5f49504 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Use logging functions from logging_util.pyPatrik Teivonen2022-10-181-10/+19
| | | | | | | | | | | | | -Remove inconsistent print function/logging module usage across scripts -Initialize logger from logging_util.py -Use CI friendly format in logging to stdout -Log file format with extra debug information (script, line, process) -Remove rainbow_logging_handler in favor of colorlog -Remove unnecessary print/log functions from unit tests -Remove unnecessary whitespace in logging messages Change-Id: Ib913cf2f6a2b02e06628f94dceeeaf845191b96b Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Add missing type hints, enable strict mypy checkingPatrik Teivonen2022-09-221-6/+7
| | | | | | | | Enable --strict parameter in mypy. Add missing type hints and resolve remaining type errors. Change-Id: Id9547cc3351b88729930c577d4ed628780c1447b Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* pep8-naming: N806 variable in function should be lowercasePatrik Teivonen2022-09-081-95/+95
| | | | | | | Add this check and rename variables. Change-Id: I95b933bcf0834bcb8f0c3cda92090ce1d481d398 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* pep8-naming: N803 argument name should be lowercase (function arguments)Patrik Teivonen2022-09-071-10/+10
| | | | | | | Enable this check and rename function arguments to be PEP8 compliant. Change-Id: Ia75f66decdab75197335b1cff5f87c6f25b0d259 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* pep8-naming: N802 function name should be lowercase (function names)Patrik Teivonen2022-09-071-14/+14
| | | | | | | Enable this check and rename functions. Change-Id: Ifc6c3248f6c6b90a240d66bb2d20cd716d887729 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Reduce use of module globals by wrapping code outside functions in mainPatrik Teivonen2022-09-061-244/+248
| | | | | | | | | | | -Move code from module scope to main() functions where it makes sense -Pass module variables as arguments to functions that used them Linters will complain about naming clashes in outer scope if same name is used in a function. Change-Id: I1319cf1632f94907ee918e6f7593c79b0909e48b Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Remove obsolete function rename_android_soname_filesPatrik Teivonen2022-08-301-5/+0
| | | | | | | This function is not needed. Change-Id: I533451c24f6bad9e497be190aa2c130318bfff4c Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* adjust to cleanupsTim Jenssen2022-08-241-1/+1
| | | | | | | | Some function calls were still passing callerArguments to runCommand Finish callerArguments cleanup Change-Id: I5fbc7f396557d6bd9385f9d64c802804acad9551 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* pylint: Remove unnecessary bits of codePatrik Teivonen2022-08-231-3/+2
| | | | | | | | | | | | | | | | | | | Enable pylint checks, and fix the following anti-patterns: - superfluous-parens - no-else-return, no-else-raise, no-else-break, no-else-continue - unnecessary-comprehension - pointless-statement, pointless-string-statement - unnecessary-pass, useless-return - unused-variable, unused-argument - useless-object-inheritance - condition-evals-to-constant - simplifiable-if-expression - redundant-unittest-assert Requires to be submitted with the following change in tqtc-qtsdk: 251649c633eb7acc417cf88fd1c7f885e2bccd7b Change-Id: I3dd50a7030e06565ae6c04d0a0e3aa07bc68218f Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* pylint: Add string formatting checks, use f-string and lazy % formattingPatrik Teivonen2022-08-161-23/+18
| | | | | | | | | | | Enable following checks in pylint: - C0209: Formatting a regular string which could be a f-string - W1202: Use lazy % formatting in logging functions - W1203: Use lazy % formatting in logging functions Use f-string for string formatting where recommended and lazy % formatting in logging. Change-Id: I14924d27e0f800c47af1ec903be4c51f24191d26 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Make imports consistent across Python scripts, isort hookv6.4.0-beta3-packagingPatrik Teivonen2022-08-051-22/+37
| | | | | | | | | | | | | | | | | | -Add isort to Pipfile, isort hook with blackformatter profile -Fix imports in unittest hook -Group and sort imports by their category (PEP8) -Blank line between import groups (PEP8) -Move all imports to toplevel (PEP8) -Don't unnecessarily append to sys.path (PEP8) -Import only required functions (this also helps reduce line length) -Update deprecated imports such as builtins.WindowsError, ConfigParser.readfp -Remove Python 2, cyclic and unused imports -Fix platform dependent imports and remove unnecessaty try-excepts -Remove unnecessary comments before imports, use in-line comments when needed -Rename conflicting functions in imports, variables as absolute imports are recommended (PEP8) Change-Id: I5ac7a3499ea47a6bdc9a9a2b5211841f65c011ea Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* PEP8: Fix indentationv6.2.5-lts-packagingPatrik Teivonen2022-07-111-20/+36
| | | | | | | | | | | | | | | | | Enable flake8 indentation related checks and fix indentation: - E123 Closing bracket does not match indentation of opening bracket's line - E126 Continuation line over-indented for hanging indent - E128 Continuation line under-indented for visual indent - E125 Continuation line with same indent as next logical line - E117 Over-indented - E124 Closing bracket does not match visual indentation - E127 Continuation line over-indented for visual indent - E111 Indentation is not a multiple of four - E121 Continuation line under-indented for hanging indent Change-Id: I2f25ed06d229b8fdaf94d69fa080dc1178ff3a2d Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* PEP8: Fix whitespacePatrik Teivonen2022-07-111-18/+18
| | | | | | | | | | | | | | | | | | Fix whitespace, Enable following checks in flake8: - E225 Missing whitespace around operator (E225) - E226 Missing whitespace around arithmetic operator (E226) - E231 Missing whitespace after ',', ';', or ':' (E231) - E221 Multiple spaces before operator (E221) - E201 Whitespace after '(' (E201) - E252 Missing whitespace around parameter equals - E251 Unexpected spaces around keyword / parameter equals - E202 Whitespace before ')' (E202) - E222 Multiple spaces after operator (E222) - E211 Whitespace before '(' (E211) Change-Id: Ib14a4a83dbc06cdfac511eb09912d7b9232df7e6 Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* PEP8: Blank lines in function and class definitions, file endPatrik Teivonen2022-07-111-0/+4
| | | | | | | | | | | | | | Correct the amount of lines in function and class definitions as well as at the end of the file. Enable following flake8 checks: - E301 Expected 1 blank line, found 0 - E302 Expected 2 blank lines, found 0 - E303 Too many blank lines - E305 Expected 2 blank lines after end of function or class - E306 Expected 1 blank line before a nested definition - W391 Blank line at end of file Change-Id: Ia9bb511ded47df1f43bfffa4be00abfdbda60cae Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
* PEP8: Remove unused vars, modules, and string formattingPatrik Teivonen2022-07-111-2/+1
| | | | | | | | | | | | | Enable following checks in flake8, and fix the resulting errors: -F401 Module imported but unused -F841 Local variable name is assigned to but never used -F811 redefinition of unused module -F541 (f-string is missing placeholders) -F523 .format(...) unused positional arguments Change-Id: Iba0e9f0148054d86b39b31202aba81a7f5c03a93 Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Add pre-commit hook for flake8, PEP8 compliant commentsPatrik Teivonen2022-07-111-3/+3
| | | | | | | | | | | | | | | | Change block and inline comments to be PEP8 compliant. (Note: line lengths will be enforced in a separate patch) Add pre-commit hook for flake8, and enable only checks relevant to this patch: - E265 Block comment should start with '# ' - E266 Too many leading '#' for block comment - E261 At least two spaces before inline comment - E262 Inline comment should start with '# ' - E115 expected an indented block (comment) Change-Id: I0218772bfbea514b4a0d8ecc461845c4563396da Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* PEP8 compliant copyright headers in Python scriptsv6.4.0-beta2-packagingPatrik Teivonen2022-07-071-25/+25
| | | | | | | | | | | | | -Update year and license header -Update header formatting to match others in send_header_diff_kmail.py -Change "## " to "# " in license headers to make them PEP8 compliant. -Reference: https://peps.python.org/pep-0008/#block-comments -flake8 rule descriptions and codes: -Block comment should start with '# ' (E265) -Too many leading '#' for block comment (E266) Change-Id: Ife039694462e9908bc22ab253ba3202c7245a7a3 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Move bldinstallercommon.do_execute_sub_process to runner.pyPatrik Teivonen2022-06-221-1/+2
| | | | | | | | Moving this function since runner.py already has similar functionality so it makes more sense to have it there. Change-Id: Iedd4a5ba050a917258f303c21ae0edf4c30b5915 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Refactor path search functionsPatrik Teivonen2022-06-211-28/+18
| | | | | | | | | | | | | | | -Remove following functions from bldinstallercommon.py -make_files_list -delete_files_by_type_recursive -locate_file -locate_directory -is_executable -Refactor locate_executable, search_for_files -Add functions locate_path, locate_paths that use pathlib.rglob -Add unit test for search_for_files Change-Id: I39d2d672c6088181a1adba5cf7ce1b93426e4e43 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Remove bldinstallercommon.create_dirs and utilize pathlib.Path.mkdirPatrik Teivonen2022-05-311-3/+4
| | | | | | | | Remove create_dirs(). Use mkdir function provided by pathlib. Having a separate function for this doesn't make sense. Change-Id: Idb486657f9c3c79b56c81a4718b8d68d8a64a68f Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Remove platform specific initialization from bldinstallercommonIikka Eklund2022-05-311-13/+11
| | | | | | | | | | | | | | | | | | | | The current way of using bldinstallercommon is cumbersome. The bldinstallercommon "requires" initialization which in turn sets up global variables for current platform. Put the conviniency functions: is_windows() is_macos() is_linux() into bld_utils.py which should serve as a place where remainder of the utilities can go. The bldinstallercommon needs to be split into separate files/modules per functionality in the long term. Remove also Solaris support and IFW cross-compilation support which are no longer needed. Change-Id: Iecafac7e658ca05223b073ad551007fa7187fb0b Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Revert "Replace bldinstallercommon.remove_tree with shutil.rmtree"Patrik Teivonen2022-05-181-3/+3
| | | | | | | | | This reverts commit ac6f75fce1b3c08eeb7dac541c80d35a11ef5cc6. Reason for revert: issue with windows offline build Change-Id: Ide6c7f035c16e0578b857ba848355c0e3779325e Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Replace bldinstallercommon.remove_tree with shutil.rmtreePatrik Teivonen2022-05-161-3/+3
| | | | | | | Use shutil.rmtree. Add onerror handler function. Change-Id: I97bd6efcc0c9328d0105399ccf55484ae70c6b5c Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* fix init_environment -> extra_environmentTim Jenssen2022-04-141-4/+4
| | | | | | | | | | | | The name was wrong and it was always used as a dict with extra environment keys/variables. Not sure why the before python3 refactor code worked, but this brings back the old behavior that these extra variables are overwritting exsting ones. Change-Id: I780cf477995f613e94c6c21116460f58af859972 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Patrik Teivonen <patrik.teivonen@qt.io>
* Port build_wrapper.py to Python 3.6Patrik Teivonen2022-04-081-28/+15
| | | | | | | | Initial port for build_wrapper.py and related scripts Change-Id: Icdf24193462e1a4746868782bd2ff95cd347b1ad Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Raise exception instead of using sys.exitIikka Eklund2016-08-231-7/+7
| | | | | | | | | The sys.exit terminates just the current thread. This is an issue if using the threadedwork.py with multiple threads as any failure should terminate the whole script. Change-Id: I9926c4cf9c6754a5182d331dae5a2e66c5ff95b6 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Add GammaRay build.Eike Ziller2015-11-121-0/+4
| | | | | Change-Id: I1bcb0bfa9822e4bc9096fd4825342b43c2c2ec15 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* bld_module: Allow using cmake for Makefile generationEike Ziller2015-10-301-15/+43
| | | | | Change-Id: I2a67d209db589108c8b89c86496bc616c86e7c8f Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Fix race condition when downloading and extracting QtEike Ziller2015-10-281-2/+2
| | | | | | | | | | | | | | On Windows, using 7zip in parallel to unzip into the same directory regularly fails. It checks whether a directory exists and creates it if not. Creating directories fails if the directory already exists. So, if a different process (e.g. different 7z) creates the directory between the check for existence and the creation, the latter fails. Split the Qt download and extract into a parallel download phase and a sequential extract phase. Change-Id: I2e8f841a467267815ad2338b12cc0f388f8e8e57 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* bld_module: allow setting module name through command line parameterEike Ziller2015-10-221-4/+6
| | | | | Change-Id: Iba6a8467a8840d6d1e8e4a936c3a6ed87ff765cb Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* bld_module: Pre-patch install path as well as Qt install pathEike Ziller2015-10-211-10/+10
| | | | | | | | Depending on the module, it might write paths relative to its install path, not the Qt install path. Change-Id: Idbb676f44850d985347438042edf2cc6eee9ab38 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Simplify getting QT_INSTALL_PREFIXEike Ziller2015-10-211-21/+4
| | | | | | | | | - There is no need for a complicated search for qmake - With "qmake -query <VAR>" it is possible to get just the value for the wanted variable Change-Id: I72387406e5c05aa7343dab37fda3639adcac8ade Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Fix --qt5pathEike Ziller2015-10-211-1/+2
| | | | | | | | At archiving phase this was hardcoded to have last path component "qt5_package_dir" which doesn't work when using any other --qt5path Change-Id: I7854884d3b58f5864a5aa26cf1c004333e19de7e Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Do not use os.sepEike Ziller2015-10-211-8/+7
| | | | | | | Use os.path.join and also simplify dir_to_archive usage Change-Id: Iaf27f21c7fc16542175a590d93e3a6cd4c6a7f12 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Style fixes for Windows special handlingEike Ziller2015-10-211-6/+4
| | | | | | | | | - No need for multiple if is_win_platform - Wrongly placed comment about stripping drive letter - There is os.path.dirname for getting the directory name Change-Id: Id28bc7f2328c004dd399c9cea6764287b9189d23 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Fix using --module_dirEike Ziller2015-10-211-4/+4
| | | | | Change-Id: I35d1b30648386c5e7e4077a43df772e5b13ebf98 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Use bldinstallercommon.is_<foo>_platform()Eike Ziller2015-10-211-8/+8
| | | | | Change-Id: I827a8a28de4d19add1fa3475bf633d5823af2264 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: cleanup uses of runCommandEike Ziller2015-10-211-24/+22
| | | | | | | | | | | | | - No need to define makeCommand or installCommand, since callerArguments.buildcommand/installcommand default to 'make' anyhow - Use bld_utils.runBuildCommand and bld_utils.runInstallCommand where appropriate - Prefer arrays for the command. That is much safer since otherwise argument splitting is always done at whitespace (and then whitespace cannot be part of an argument) Change-Id: I3c708370f81407546224e21ab7252b992f82e30c Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Share code for downloading and installing QtEike Ziller2015-10-211-26/+6
| | | | | | | | It was duplicated between bld_module and bld_qtcreator, and will probably be interesting for later things as well. Change-Id: Iaab7cd84d01f5f7a35eb0511a5e014c38e01a258 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Do not use different arguments for Qt module URLsEike Ziller2015-10-211-27/+17
| | | | | | | | | Getting and extracting works exactly the same way for different Qt modules, so we can get rid of some duplicated code by using an argument that can appear multiple times, and iterating over it. Change-Id: I87c7696b045077dd7f727d9f2f644e375406706e Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* bld_module: Remove unused code pathsEike Ziller2015-10-211-34/+4
| | | | | | | | | | | | | | - the targetPath was not actually used in these places - we don't use the installer framework for patching on OS X anymore, so we don't need to fetch it - INSTALLER_ARCHIVE is a leftover from copying from the Qt Creator build, here we archive manually without the need for that environment variable - keychain unlock script and SIGNING_IDENTITY are leftovers from the Qt Creator build Change-Id: Ida678d4192b3a5f97233e68fa7b2b78b56f97d22 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Extract and share create_download_extract_taskEike Ziller2015-10-211-26/+7
| | | | | | | From bld_module and bld_qtcreator Change-Id: I18446f8c1f593562d319e5b1d73417f3e3bdac48 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Cleanup environment variables and rename "application" as "module"Iikka Eklund2015-09-151-0/+450
Rename "*application*" and "*extra*" as "module" in packaging scripts to better reflect the actual usage. Cleanup environment variable usage in packaging scripts: - Removed unused envrironment variables. - Renamed some environment variables as similar already existed - Removed deprecated envrironment setup helper scripts Change-Id: Ie4bcdd67febe42f3b9f718db98e06a552d0d79e5 Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>