-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Spack needs a better way to install packages that don't have install targets. #31
Description
There are a lot of tools in filesystem.py, but there could be more. @malcook has an example where he wants symlink to be preserved when copying trees into place.
install_tree, being defined in terms of
shutil.copytree is not very useful for what I expect will be the most sought after use case, as described with a workaround : http://stackoverflow.com/a/12514470 which I employ below.
I also wonder if there are pythonic/spack-esque replacements for my os.system calls below, written for a bioinformatics ‘app’ where all executables are creates in top level directory and ‘install’ is left to user whimsy:
def install(self, spec, prefix):
## no configure
make() # this makefile has no PREFIX or
# `install` target.
## APPROACH: executables are all at top-level, so symlink them
## into ./bin dir and then COPY THE ENTIRE STAGING DIRECTORY
## (allowing for symlinks). This is ugly but it works, it is
## complete, and is consistent with how the application is
## packaged (if it ain't fixed don't fix it more than you
## must).
mkdirp('bin')
## TODO: make portable to non linux?
os.system("find * -maxdepth 0 -type f -executable -exec ln -rsf -t bin '{}' \;") # symlink into ./bin all top-level executables.
os.system('ln -rsf -t bin ./scripts/*') # also, symlink into ./bin all scripts (and the ./scripts/test directory)
copytree('./',prefix,symlinks=True) # N.B. using copytree per http://stackoverflow.com/a/12514470
Ideally the above functionality would be available in Python and would work without the various shell commands used.