[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hard-coded /gnu/store patches cause test-env to not work properly

From: Caleb Ristvedt
Subject: hard-coded /gnu/store patches cause test-env to not work properly
Date: Tue, 08 Jan 2019 01:44:53 -0600

Well, I finally (it only took 4 days!) found out what was causing
address@hidden to fail to build only in the test environment:

Add all /gnu/store/ prefixes found in PYTHONPATH to the prefixes where
site-packages (and .pth files) are searched.

*** Python-2.7.11/Lib/      2016-10-17 23:27:23.746149690 +0200
--- Python-2.7.11/Lib/   2016-10-17 23:44:51.930871644 +0200
*** 65,70 ****
--- 65,82 ----
  # Prefixes for site-packages; add additional prefixes like /usr/local here
  PREFIXES = [sys.prefix, sys.exec_prefix]
+ # Guix: Add all /gnu/store-paths in PYTHONPATH--these are all
+ # "prefixes".  This is required to search .pth files in all python
+ # packages contained in /gnu/store which is required to make
+ # .pth-defined namespace packages work.
+ # This is necessary if the packages are not merged into a single
+ # `site-packages` directory (like when using `guix environment`) but
+ # listed in PYTHONPATH (like when running `guix build`).
+ for p in sys.path:
+     if p.startswith('/gnu/store/'):
+         PREFIXES.append(p[:p.find('/', 44)]) # find first pathsep after hash
+ del p
  # Enable per user site-packages directory
  # set it to False to disable the feature or True to force the feature

Of course, /home/reepca/Programming/guix/test-tmp/store/ wouldn't be
recognized. I manually modified the patch and re-attempted building
flake8 with the new python2 and sure enough, it succeeded.

Perhaps more practically, this is also an issue for anyone who installed
guix with their store in a non-standard location. Are we currently
assuming that anyone installing in a non-/gnu/store location is going to
have NIX_STORE set? If so, the solution seems pretty easy: do what the
other patches involving /gnu/store do and first attempt to honor that,
only falling back to /gnu/store as a default. In that case, we should
also modify proot-test-fhs.patch, as it also hardcodes /gnu/store
without first attempting to honor NIX_STORE. This should at least
resolve the issue for test-env, since NIX_STORE is always set in
test-env and you don't need to run the programs there outside of
test-env in order to test building (the main purpose).

If we aren't assuming NIX_STORE is set for non-/gnu/store installs, then
I guess we'd have to start generating patches based on the configured
storedir. But I get the feeling it's not much of a concern.

Attached is a patch that fixes python-2.7-site-prefixes.patch.

Attachment: signature.asc
Description: PGP signature

Description: site-prefixes patch

reply via email to

[Prev in Thread] Current Thread [Next in Thread]