Created
December 2, 2013 14:03
-
-
Save boegel/7749904 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat qiime.py | |
import os, shutil | |
from easybuild.apps.Application import Application | |
from easybuild.apps.Precompiled import Tarball | |
from easybuild.apps.Toolbox import PythonModuleSeparate | |
from easybuild.apps.Compiler import CMake | |
from easybuild.buildsoft.fileTools import convertName, runrun, runqanda | |
from distutils.version import LooseVersion | |
# PythonPackage should do here (not verified) | |
class QIIME(PythonModuleSeparate): | |
def test(self): | |
if self.getCfg('testinstall'): | |
testinstalldir = os.path.join(self.builddir, "mytemporarytestinstalldir") | |
qiimeconfigfile = os.path.join(self.builddir, "qiime_config") | |
qiimeconfigtxt = "qiime_scripts_dir %s" % testinstalldir | |
try: | |
f = open(qiimeconfigfile, 'w') | |
f.write(qiimeconfigtxt) | |
f.close() | |
self.log.debug("Successfully created test qiime_config file at: %s" % qiimeconfigfile) | |
except Exception, err: | |
self.log.error("Failed to create test qiime_config file at: %s (%s)" % (qiimeconfigfile, err)) | |
extraexport = "export QIIME_CONFIG_FP=%s && " % qiimeconfigfile | |
extrapath = "" | |
""" | |
Install in test directory and export PYTHONPATH | |
""" | |
try: | |
os.makedirs(testinstalldir) | |
except: | |
self.log.exception("Creating testinstalldir %s failed" % testinstalldir) | |
ppath = "%s/reallib" % testinstalldir | |
cmd = "python setup.py install --install-scripts=%s --install-purelib=%s %s" % (testinstalldir, ppath, self.getCfg('installopts')) | |
runrun(cmd, logall=True, simple=True) | |
if os.environ.has_key('PYTHONPATH'): | |
extrapath = "export PYTHONPATH=%s:%s && " % (ppath, os.environ['PYTHONPATH']) | |
else: | |
extrapath = "export PYTHONPATH=%s && " % ppath | |
if self.getCfg('runtest'): | |
cmd = "%s%s%s" % (extraexport, extrapath, self.getCfg('runtest')) | |
runrun(cmd, logall=True, simple=True) | |
def makeModuleExtra(self): | |
"""Overwritten from PythonModuleSeparate to add extra txt""" | |
txt = PythonModuleSeparate.makeModuleExtra(self) | |
scriptsdir = os.path.join(self.installdir, 'bin') | |
qiimeconfigfile = os.path.join(self.installdir, "qiime_config") | |
qiimeconfigtxt = "qiime_scripts_dir %s" % scriptsdir | |
try: | |
f = open(qiimeconfigfile, 'w') | |
f.write(qiimeconfigtxt) | |
f.close() | |
self.log.debug("Successfully created qiime_config file at: %s" % qiimeconfigfile) | |
except Exception, err: | |
self.log.error("Failed to create qiime_config file at: %s (%s)" % (qiimeconfigfile, err)) | |
return txt + "prepend-path\tQIIME_CONFIG_FP\t\t%s\n" % qiimeconfigfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
easyconfig: