Age | Commit message (Collapse) | Author |
|
Instead of printing the "str()" representation of the excaption, print the
"repr()" representation. This will print the name of the exception and thus
ease understanding the actual error.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
|
Fixes <https://issues.guix.gnu.org/52269>.
* gnu/packages/aux-files/python/sitecustomize.py: Use site.addsitedirs to add
the site directories; this takes care of the .pth files. Make sure the added
items still appear before Python's own 'site-packages' directory.
|
|
Fixes <https://issues.guix.gnu.org/50105>.
* gnu/packages/aux-files/python/sitecustomize.py: Add a comment explaining the
general idea, and use sys.prefix instead of sys.executable.
(major_minor): Use the unpacking operator (*) to provide the arguments.
(site_packages_prefix): Use os.path.join to form the path.
(python_site): Likewise. Use sys.prefix instead of sys.executable.
(all_sites_raw): Split on os.path.pathsep.
(sys.path): Directly splice the result in the list.
Suggested-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Reported-by: Mathieu Othacehe <othacehe@gnu.org>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
|
* gnu/packages/aux-files/python/sanity-check.py: Catch the less specific
EnvironmentError rather than FileNotFoundError as the latter is Python 3
only.
|
|
This exception was thrown while running the sanity-check on the python-isort
package, which doesn't make use of a setuptools-based build system but rather
of a PEP 517 compliant one.
* gnu/packages/aux-files/python/sanity-check.py: Handle the FileNotFoundError
whe attempting to read the 'top_level.txt' metadata file of the package.
Remove extraneous 'continue' statement.
|
|
Add a new phase validating the usability of installed Python packages.
* gnu/packages/aux-files/python/sanity-check.py: New file.
* Makefile.am (AUX_FILES): Register it.
* guix/build-system/python.scm (sanity-check.py): New variable.
(lower): Add the script as an implicit input.
* guix/build/python-build-system.scm: Remove trailing #t.
(sanity-check): New phase.
(%standard-phases): Use it.
* tests/builders.scm: (make-python-dummy)
(dummy-ok, dummy-dummy-nosetuptools, dummy-fail-requirements)
(dummy-fail-import, dummy-fail-console-script): New variables.
("python-build-system: dummy-ok")
("python-build-system: dummy-dummy-nosetuptools")
("python-build-system: dummy-fail-requirements")
("python-build-system: dummy-fail-import")
("python-build-system: dummy-fail-console-script"): Add tests.
|
|
Using PYTHONPATH as a mean to discover the Python packages had the following
issues:
1. It is not versioned, so different versions of Python would clash if
installed in a shared profile.
2. It would interfere with the host Python site on foreign
distributions, sometimes preventing a a user to login their GDM
session (!).
3. It would take precedence over user installed Python packages
installed through pip.
4. It would leak into Python virtualenvs, which are supposed to create
isolated Python environments.
This changes fixes the above issues by making use of a sitecustomize.py
module. The newly introduced GUIX_PYTHONPATH environment variable is read
from the environment, filtered for the current Python version of the
interpreter, and spliced in 'sys.path' just before Python's own site location,
which provides the expected behavior.
* gnu/packages/aux-files/python/sitecustomize.py: New file.
* Makefile.am: Register it.
* gnu/packages/python.scm (customize-site)
(guix-pythonpath-search-path): New procedures.
(python-2.7)[phases]{install-sitecustomize.py}: New phase.
[native-inputs]{sitecustomize.py}: New input.
[native-search-paths]: Replace PYTHONPATH with GUIX_PYTHONPATH.
(python-3.9)[native-search-paths]: Likewise.
[phases]{install-sitecustomize}: Override with correct version.
[native-search-paths]: Replace PYTHONPATH with GUIX_PYTHONPATH.
* gnu/packages/commencement.scm (python-boot0):
[phases]{install-sitecustomize}: Likewise.
[native-inputs]{sitecustomize.py}: New input.
[native-search-paths]: Replace PYTHONPATH with GUIX_PYTHONPATH.
* guix/build/python-build-system.scm (site-packages): Do not add a trailing
'/'.
squash! gnu: python: Replace PYTHONPATH by GUIX_PYTHONPATH.
|