<feed xmlns='http://www.w3.org/2005/Atom'>
<title>packages/lang/python/python-package-install.sh, branch master</title>
<subtitle>Community maintained packages for OpenWrt</subtitle>
<id>http://x-nagi.com/cgit/packages/atom?h=master</id>
<link rel='self' href='http://x-nagi.com/cgit/packages/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/'/>
<updated>2023-08-24T17:47:43Z</updated>
<entry>
<title>python: Rework filespec install script</title>
<updated>2023-08-24T17:47:43Z</updated>
<author>
<name>Jeffery To</name>
<email>jeffery.to@gmail.com</email>
</author>
<published>2023-06-29T07:27:40Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=2ffb87726b93ffd73a5291d6db1bc3d13fbcde17'/>
<id>urn:sha1:2ffb87726b93ffd73a5291d6db1bc3d13fbcde17</id>
<content type='text'>
* 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 &lt;jeffery.to@gmail.com&gt;
</content>
</entry>
<entry>
<title>python3: Move functionality into python3-package.mk</title>
<updated>2020-04-18T17:56:23Z</updated>
<author>
<name>Jeffery To</name>
<email>jeffery.to@gmail.com</email>
</author>
<published>2020-04-14T13:14:49Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=3cdca38dce01553766b032d8bbfce08a35d6555e'/>
<id>urn:sha1:3cdca38dce01553766b032d8bbfce08a35d6555e</id>
<content type='text'>
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 &lt;jeffery.to@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: add Py[3]Shebang functions &amp; move outside of script</title>
<updated>2019-09-20T11:10:00Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2019-09-12T12:03:50Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=721642908c2bc2f16ff371bdd33e4df02813318c'/>
<id>urn:sha1:721642908c2bc2f16ff371bdd33e4df02813318c</id>
<content type='text'>
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 &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
<entry>
<title>python: change condition check for legacy opt for Python3</title>
<updated>2019-09-20T10:42:21Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2019-09-09T10:10:22Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=b104c56e2ba23e972d8f14280b41dd54f22ba302'/>
<id>urn:sha1:b104c56e2ba23e972d8f14280b41dd54f22ba302</id>
<content type='text'>
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 &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: Increase max recursion level when generating bytecode</title>
<updated>2019-04-03T19:07:02Z</updated>
<author>
<name>Jeffery To</name>
<email>jeffery.to@gmail.com</email>
</author>
<published>2019-04-03T18:45:19Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=85c805d0ada334c0b90c3b74bc4b7c5779627e11'/>
<id>urn:sha1:85c805d0ada334c0b90c3b74bc4b7c5779627e11</id>
<content type='text'>
"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 &lt;jeffery.to@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: Fix overridden usr/bin symlinks</title>
<updated>2019-04-03T13:05:14Z</updated>
<author>
<name>Jeffery To</name>
<email>jeffery.to@gmail.com</email>
</author>
<published>2019-03-31T11:11:15Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=0280c67103f525937569528c8ba88fa3e144a903'/>
<id>urn:sha1:0280c67103f525937569528c8ba88fa3e144a903</id>
<content type='text'>
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 &lt;jeffery.to@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: move shebang handle in install script</title>
<updated>2019-02-12T10:31:55Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2019-02-04T14:36:25Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=ed862da9367a6f488a9afee78bfc99dbc9b6906a'/>
<id>urn:sha1:ed862da9367a6f488a9afee78bfc99dbc9b6906a</id>
<content type='text'>
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 &amp;
python[3]-setuptools.

Signed-off-by: Alexandru Ardelean &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: make deletion tolerant for paths with spaces</title>
<updated>2019-02-12T10:31:54Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2019-02-05T10:04:43Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=1bf7679211425bb0f63f22ce00c700c7d84eb2d4'/>
<id>urn:sha1:1bf7679211425bb0f63f22ce00c700c7d84eb2d4</id>
<content type='text'>
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 &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
<entry>
<title>python,python3: move .exe removal in `python-package-install.sh` script</title>
<updated>2019-02-04T14:38:12Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2019-02-04T14:10:08Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=14d0a9c58dc12c089c3d2209ebb1d9b37b68abad'/>
<id>urn:sha1:14d0a9c58dc12c089c3d2209ebb1d9b37b68abad</id>
<content type='text'>
It's a common operation for both Python &amp; Python3, so move it to the
script `python-package-install.sh` script.

Signed-off-by: Alexandru Ardelean &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
<entry>
<title>lang/python/python-package-install.sh: assign SOURCE_DATE_EPOCH to PYTHONHASHSEED</title>
<updated>2018-03-07T18:52:15Z</updated>
<author>
<name>Alexandru Ardelean</name>
<email>ardeleanalex@gmail.com</email>
</author>
<published>2018-03-07T18:43:35Z</published>
<link rel='alternate' type='text/html' href='http://x-nagi.com/cgit/packages/commit/?id=f53904ebdac8e94977f89170a3369241c748f30f'/>
<id>urn:sha1:f53904ebdac8e94977f89170a3369241c748f30f</id>
<content type='text'>
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 &lt;ardeleanalex@gmail.com&gt;
</content>
</entry>
</feed>
