aboutsummaryrefslogtreecommitdiff
path: root/lang/python/python-package-install.sh
Commit message (Collapse)AuthorAge
* python: Rework filespec install scriptJeffery To2023-08-25
| | | | | | | | | | | | | | | | | | | | | | | | | | * Support wildcards in install (`+`) paths * Add fourth parameter to set directory permissions If file permissions are given (third parameter), these will now apply to files only. * Add non-recursive set permissions command (`==`) * Be more strict about filespec format Blank lines and lines starting with `#` will be ignored. Other errors (unknown command, missing path parameter, etc.) will cause the script to exit. * Be more strict about ensuring paths exist for all commands * Avoid spawning subshells This also removes outdated filespec paths in the python3 package; these paths delete files that are no longer present. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* python3: Move functionality into python3-package.mkJeffery To2020-04-19
| | | | | | | | This moves functionality from python-package-install.sh into python3-package.mk, so that they can be reused separate from filespec processing. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* python,python3: add Py[3]Shebang functions & move outside of scriptAlexandru Ardelean2019-09-20
| | | | | | | | | | | | | | | | Some packages just install some Python binaries, that may need their shebang fixed. This change adds some utilities to help with that and try to centralize the sed rules a bit. It also removes the logic from the `python-package-install.sh` into the `python-package[3].mk` files. This does 2 things: 1. It minimizes the need for the shell script to know the Python version 2/3 2. Makes the logic re-usable in packages; especially if the install rules differ a bit Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python: change condition check for legacy opt for Python3Alexandru Ardelean2019-09-20
| | | | | | | | As I remember this worked. But since `set -e` is set, I am a bit paranoid about it. In the sense that it may fail if `ver` != 3. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python,python3: Increase max recursion level when generating bytecodeJeffery To2019-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | "python -m compileall" has a default maximum recursion level of 10, i.e. it will descend up to 10 levels of subdirectories when looking for source files to compile. This is usually sufficient but there are packages that include more than 10 levels (botocore, https://github.com/openwrt/packages/pull/8214#discussion_r270056741). This adds the "-r" command line option to the call to compileall to increase the max recursion level (currently set to 20). This also patches Python 2's compileall.py to add this max recursion level option. (Python 3's compileall.py already supports this option.) This also applies some related changes to python-package-install.sh: * Use the "-delete" option with find instead of exec'ing rm / rmdir. For the case of removing empty directories (in delete_empty_dirs()), this has the added benefit of simplifying the code, as the "-delete" option implies "-depth", and thus find "does the right thing" (removing empty directories depth-first). * Remove the backslash in "-name" patterns (for find), as they are not regular expression but glob patterns. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* python,python3: Fix overridden usr/bin symlinksJeffery To2019-04-03
| | | | | | | | | | | | | Currently, all files in usr/bin (presumably all Python scripts) are run through sed to replace the shebang; sed will overwrite the file whether or not a match is found. This causes symlinks to be overridden and made into copies of their targets. python[3]-base and python[3]-dev are affected by this. This adds the --follow-symlinks flag to sed, in addition to using $(SED), so that symlinks are not overridden. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* python,python3: move shebang handle in install scriptAlexandru Ardelean2019-02-12
| | | | | | | | | | | | This extends the Python[3] shebang fixup to all packages. Only Python scripts in `/usr/bin` will be handled at the moment. Later it may make sense to also cover executables in `/bin`, though typically Python executables shouldn't be placed there. Previously the shebang handling was only done for python[3]-pip & python[3]-setuptools. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python,python3: make deletion tolerant for paths with spacesAlexandru Ardelean2019-02-12
| | | | | | | | | Piping to xargs does not handle spaces in paths too well, because it splits up the paths. For deleting empty dirs, we also need to do several retries, otherwise `find` will try to go through the directories after they're deleted. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python,python3: move .exe removal in `python-package-install.sh` scriptAlexandru Ardelean2019-02-04
| | | | | | | It's a common operation for both Python & Python3, so move it to the script `python-package-install.sh` script. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* lang/python/python-package-install.sh: assign SOURCE_DATE_EPOCH to ↵Alexandru Ardelean2018-03-07
| | | | | | | | | | | | | | | | | | | | PYTHONHASHSEED Following a discussion on bugs.python.org: * https://bugs.python.org/issue29708 * https://bugs.python.org/msg313384 It seems that setting a fixed value to PYTHONHASHSEED guarantees that the bytecodes are generated consistently/in a reproducible manner. Hopefully, this is the last bit to make Python3 build reproducible. Tested this locally on a few files [that were not reproducible without this change]. The PYTHONHASHSEED is only assigned to the host Python/Python3 during compilation of byte-codes [from python source]. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python,python3: merge package install scriptsAlexandru Ardelean2018-01-10
| | | | | | | | | | | | | The only difference just a parameter for Python3 [ -b to compile bytecodes in legacy mode ]. No need to keep 2 almost identical files now that they're exported. I'm a bit scared of that param, since it may get removed at some point. But let's see until then. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* python,python3: export mk files outside of python package dirsAlexandru Ardelean2018-01-10
Since `lang/python` is it's own folder of Python packages (for both Python 2 & 3), and these build rules are needed in a lot of packages [especially Python packages], putting them here makes sense architecturally, to be shared. This also helps get rid of the `include_mk` construct which relies on OpenWrt core to provide, and seems like a broken design idea that has persisted for a while. Reason is: it requires that Python 2/3 be built to provide these mk files for other Python packages, which seems like a bad idea. Long-term, there could be an issue where some other feeds would require these mk files [e.g. telephony] for some Python packages. We'll see how we handle this a bit later. For now we limit this to this feed. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>