Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-99289: Add COMPILEALL_OPTS to Makefile #99291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2022
Merged

gh-99289: Add COMPILEALL_OPTS to Makefile #99291

merged 3 commits into from
Nov 14, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 9, 2022

Add COMPILEALL_OPTS variable in Makefile to override compileall options (default: -j0) in "make install". Merge also the 3 compileall commands into a single command building PYC files for the 3 optimization levels (0, 1, 2).

Add COMPILEALL_OPTS variable in Makefile to override compileall
options (default: -j0) in "make install". Merge also the 3 compileall
commands into a single command building PYC files for the 3
optimization levels (0, 1, 2).
@vstinner
Copy link
Member Author

vstinner commented Nov 9, 2022

Example:

./configure --prefix ~/prefix
make
make install COMPILEALL_OPTS="--hardlink-dupes -j4"

Output:

(...)
PYTHONPATH=/home/vstinner/prefix/lib/python3.12  \
	./python -E -Wi /home/vstinner/prefix/lib/python3.12/compileall.py \
	-o 0 -o 1 -o 2 --hardlink-dupes -j4 -d /home/vstinner/prefix/lib/python3.12/site-packages -f \
	-x badsyntax /home/vstinner/prefix/lib/python3.12/site-packages
(...)

compileall is called with options: -o 0 -o 1 -o 2 --hardlink-dupes -j4:

  • -o 0 -o 1 -o 2 is hardcoded
  • default -j0 was overriden with --hardlink-dupes -j4

@vstinner
Copy link
Member Author

vstinner commented Nov 9, 2022

I tested again to double check. Ah, in fact compileall is called two times: once for Lib/, once for site-packages:

(...)

PYTHONPATH=/home/vstinner/prefix/lib/python3.12  \
        ./python -E -Wi /home/vstinner/prefix/lib/python3.12/compileall.py \
        -o 0 -o 1 -o 2 --hardlink-dupes -j4 -d /home/vstinner/prefix/lib/python3.12 -f \
        -x 'bad_coding|badsyntax|site-packages|test/test_lib2to3/data' \
        /home/vstinner/prefix/lib/python3.12
Listing '/home/vstinner/prefix/lib/python3.12'...
(...)

PYTHONPATH=/home/vstinner/prefix/lib/python3.12  \
        ./python -E -Wi /home/vstinner/prefix/lib/python3.12/compileall.py \
        -o 0 -o 1 -o 2 --hardlink-dupes -j4 -d /home/vstinner/prefix/lib/python3.12/site-packages -f \
        -x badsyntax /home/vstinner/prefix/lib/python3.12/site-packages
Listing '/home/vstinner/prefix/lib/python3.12/site-packages'...
(...)

@vstinner
Copy link
Member Author

vstinner commented Nov 9, 2022

cc @hroncok

@hroncok
Copy link
Contributor

hroncok commented Nov 11, 2022

This is an improvement, thanks! OTOH we would probably also like an opinion to disable this entirely and do it ourselves.

@vstinner
Copy link
Member Author

Merged, thanks for the review!

@vstinner vstinner deleted the compileall_opts branch November 14, 2022 12:43
@vstinner
Copy link
Member Author

OTOH we would probably also like an opinion to disable this entirely and do it ourselves.

That can be a separated option.

IMO this change alone is already an enhancement ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants