Open matz-e opened 7 years ago
We could also do this with the script setuptools keyword? It seems possible we could even check the environment to see if the VIRTUALENV
is set inside the script, and if not set it up and try again. That might get us to the hallowed pip install lobster
full installation.
I thought that script
was more for launching the final program? I'm not sure we should do some final installation steps on the first time we launch Lobster, that sounds dangerous. Am I missing something there?
Ah, good point @matz-e. I looked up the documentation and then assumed I knew what it said instead of reading it carefully 😞 .
WARNING! The approach that follows is convoluted and works in unexpected ways and you should ignore it. I just went on a stackoverflow joyride and ended up in a place nobody should ever go. We should definitely not do this. It was just an exercise for my education.
It looks like you can accomplish running the setup script automatically with cmdclass
, here's a toy:
import os
from setuptools import setup
from setuptools.command.install import install
class Install(install):
def run(self):
os.system("echo 'do my stuff!'")
install.run(self)
setup(
name="spam",
author="Feynman",
packages=['eggs'],
cmdclass={'install': Install}
)
I sketched out how this could work here. Using this approach, you can start without cctools or virtualenv installed/enabled, and get them setup automatically :
[earth] ~/lobster >type lobster
-bash: type: lobster: not found
[earth] ~/lobster >type parrot_run
-bash: type: parrot_run: not found
[earth] ~/lobster >pip install --no-deps --user --upgrade .
[earth] ~/lobster >. ~/.lobster/bin/activate
(.lobster) [earth] ~/lobster >type parrot_run
parrot_run is /afs/crc.nd.edu/user/a/awoodard/.lobster/bin/parrot_run
So the instructions would change from (assuming setuptools is already installed) this for install:
cd my-release-top
cmsenv
cd -
cctools=lobster-142-55035a54-cvmfs-40cf5bba
wget -O - http://ccl.cse.nd.edu/software/files/${cctools}-x86_64-redhat6.tar.gz
export PATH=$PWD/${cctools}-x86_64-redhat6/bin:$PATH
export PYTHONPATH=$PWD/${cctools}-x86_64-redhat6/lib/python2.6/site-packages:$PYTHONPATH
pip install --user virtualenv
virtualenv --system-site-packages ~/.lobster
. ~/.lobster/bin/activate
wget -O - https://raw.githubusercontent.com/matz-e/lobster/master/install_dependencies.sh|sh -
pip install https://github.com/matz-e/lobster/tarball/master
And this for running:
cd my-release-top
cmsenv
cd -
. ~/.lobster/bin/activate
To this for install (after putting Lobster in pypi):
cd my-release-top
cmsenv
cd -
pip install --no-deps --user --upgrade .
And this for running (assuming you want to run with the same CMSSW you installed with, which is always your safest bet-- you could still cmsenv somewhere else first if you wanted to):
. ~/.lobster/bin/activate
Note that I had to change #!/usr/bin/python
to #!/usr/bin/env python
in ~/.local/bin/pip
for the above to work, not sure what's up with that.
OK, end section which is needlessly convoluted and should be ignored.
On a serious note (as the above comment should have been ignored):
One script to produce output that configures the environment for both csh :(, bash, fish, and, if necessary, downloads cctools to
~/.cache/cctools-$version
.
I would vote to download cctools into $VIRTUAL_ENV
. It is a dependency, why not keep it with the other dependencies? That would preclude caching, but I would argue that it's worth it to make 100% sure that the cctools + lobster versions are harmonious, and you never forget which cctools version goes with your lobster version.
Awesome, and yes, keeping it in $VIRTUALENV
probably is better than .cache
.
After DBS comes from the cheese shop, we should include the dependency installation script (cctools only by then) verbatim in the installation instruction (one less file to change).
Maybe even put the whole environment set up in there? One script to produce output that configures the environment for both csh :(, bash, fish, and, if necessary, downloads cctools to
~/.cache/cctools-$version
.