-
Notifications
You must be signed in to change notification settings - Fork 284
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
verify installation of a dummy Python package before actually installing a Python package #475
base: develop
Are you sure you want to change the base?
Conversation
…ing a Python package
} | ||
run_cmd(cmd, log_all=True, simple=True) | ||
|
||
# setuptools stubbornly replaces the shebang line in scripts with |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
# setuptools stubbornly replaces the shebang line in scripts with | ||
# the full path to the Python interpreter used to install; | ||
# we change it (back) to '#!/usr/bin/env python' here | ||
shebang_re = re.compile("^#!/.*python") |
There was a problem hiding this comment.
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
script = os.path.join(bindir, script) | ||
if os.path.isfile(script): | ||
try: | ||
txt = open(script, 'r').read() |
There was a problem hiding this comment.
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....
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 whicheversetuptools
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
: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)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 theactive
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