Skip to content

verify installation of a dummy Python package before actually installing a Python package#475

Closed
boegel wants to merge 1 commit intoeasybuilders:developfrom
boegel:verify_python_install
Closed

verify installation of a dummy Python package before actually installing a Python package#475
boegel wants to merge 1 commit intoeasybuilders:developfrom
boegel:verify_python_install

Conversation

@boegel
Copy link
Member

@boegel boegel commented Sep 12, 2014

After spending about 2h on trying to figure out why a particular setuptools installation was blatently ignoring --prefix, I was sufficiently frustrated to come up with this: a verification of whether whichever setuptools is active honors --prefix before actually installing a Python package with it.

Up until now, I've run into two different ways of making setuptools blatently ignore --prefix:

  • via the distutils.cfg or $HOME/.pydistutils.cfg configuration files which effectively override any specified --prefix comand line option (cfr. https://docs.python.org/2/install/#distutils-configuration-files)
  • by using a setuptools installation that was installed with --user into $HOME/.local, causing it to install everything to $HOME/.local regardless of what --prefix specifies (yes, you read that right)

Since there's little we can do to prevent the use of a (basically broken) setuptools installation (there's no way I'm aware of in which we can install our own and be 100% sure it'll be used), we better have a way of verifying whether the active setuptools does the right thing.

related: easybuilders/easybuild#31, #373 and last nights discussion with @kcgthb on the #easybuild IRC channel

@stdweird, @JensTimmerman: thoughts on this?

cc: @kcgthb, @chwilk, @DimitriSteyaert, @pforai, @ocaisa

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch setuptools? (the one used is one EB installed right?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, move in separate method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define in the if block

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use filehandle, so you'll open it only once (and close it explicitly)
second, don't read in the whole file, use readline or eg first 4k bytes.
after the read and match if found, don't forget to fh.seek(0) before reading the whole script.
although i'd prefer fileinput thoe all this....

@boegel boegel mentioned this pull request Mar 11, 2015
8 tasks
@boegel boegel added this to the v2.3 milestone Jul 15, 2015
@boegel boegel modified the milestones: v2.4.0, v2.5.0 Nov 6, 2015
@boegel boegel modified the milestones: v2.5.0, v2.6.0 Dec 14, 2015
@boegel boegel modified the milestones: v2.7.0, v2.6.0 Jan 23, 2016
@boegel
Copy link
Member Author

boegel commented Jan 28, 2026

No longer relevant, so closing.

Let is serve as documentation on how setuptools can be a genuine PITA...

@boegel boegel closed this Jan 28, 2026
@boegel boegel deleted the verify_python_install branch January 28, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants