Merge pull request #1044 from adamjstewart/features/sncosmo

Add py-sncosmo package
This commit is contained in:
Todd Gamblin 2016-06-17 14:50:37 -07:00 committed by GitHub
commit 9a8d109650
9 changed files with 434 additions and 103 deletions

View file

@ -24,29 +24,38 @@
##############################################################################
from spack import *
class PyAstropy(Package):
"""
The Astropy Project is a community effort to develop a single core
package for Astronomy in Python and foster interoperability between
Python astronomy packages.
"""
homepage = 'http://www.astropy.org/'
class PyAstropy(Package):
"""The Astropy Project is a community effort to develop a single core
package for Astronomy in Python and foster interoperability between
Python astronomy packages."""
homepage = 'http://www.astropy.org/'
url = 'https://pypi.python.org/packages/source/a/astropy/astropy-1.1.2.tar.gz'
version('1.1.2', 'cbe32023b5b1177d1e2498a0d00cda51')
version('1.1.post1', 'b52919f657a37d45cc45f5cb0f58c44d')
def url_for_version(self, version):
return 'https://pypi.python.org/packages/source/a/astropy/astropy-{0}.tar.gz'.format(version)
# Required dependencies
extends('python')
depends_on('py-numpy')
# Optional dependencies
depends_on('py-h5py')
depends_on('py-beautifulsoup4')
depends_on('py-pyyaml')
depends_on('py-scipy')
depends_on('libxml2')
depends_on('py-matplotlib')
depends_on('py-pytz')
depends_on('py-scikit-image')
depends_on('py-pandas')
# System dependencies
depends_on('cfitsio')
depends_on('expat')
depends_on('py-h5py')
depends_on('py-numpy')
depends_on('py-scipy')
def install(self, spec, prefix):
python('setup.py', 'build', '--use-system-cfitsio',
'--use-system-expat')
python('setup.py', 'install', '--prefix=' + prefix)
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,41 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyBeautifulsoup4(Package):
"""Beautiful Soup is a Python library for pulling data out of HTML and
XML files. It works with your favorite parser to provide idiomatic ways
of navigating, searching, and modifying the parse tree."""
homepage = "https://www.crummy.com/software/BeautifulSoup"
url = "https://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.4.1.tar.gz"
version('4.4.1', '8fbd9a7cac0704645fa20d1419036815')
extends('python')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,41 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyEmcee(Package):
"""emcee is an MIT licensed pure-Python implementation of Goodman & Weare's
Affine Invariant Markov chain Monte Carlo (MCMC) Ensemble sampler."""
homepage = "http://dan.iel.fm/emcee/current/"
url = "https://pypi.python.org/packages/source/e/emcee/emcee-2.1.0.tar.gz"
version('2.1.0', 'c6b6fad05c824d40671d4a4fc58dfff7')
extends('python')
depends_on('py-numpy')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -23,23 +23,42 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import re
class PyH5py(Package):
"""The h5py package provides both a high- and low-level interface to the HDF5 library from Python."""
"""The h5py package provides both a high- and low-level interface to the
HDF5 library from Python."""
homepage = "https://pypi.python.org/pypi/h5py"
url = "https://pypi.python.org/packages/source/h/h5py/h5py-2.4.0.tar.gz"
version('2.4.0', '80c9a94ae31f84885cc2ebe1323d6758')
version('2.6.0', 'ec476211bd1de3f5ac150544189b0bf4')
version('2.5.0', '6e4301b5ad5da0d51b0a1e5ac19e3b74')
version('2.4.0', '80c9a94ae31f84885cc2ebe1323d6758')
extends('python', ignore=lambda f: re.match(r'bin/cy*', f))
depends_on('hdf5')
depends_on('py-numpy')
depends_on('py-cython')
variant('mpi', default=False, description='Build with MPI support')
extends('python')
# Build dependencies
depends_on('py-cython@0.19:')
depends_on('pkg-config')
depends_on('hdf5@1.8.4:+mpi', when='+mpi')
depends_on('hdf5@1.8.4:~mpi', when='~mpi')
depends_on('mpi', when='+mpi')
# Build and runtime dependencies
depends_on('py-numpy@1.6.1:')
# Runtime dependencies
depends_on('py-six')
depends_on('py-pkgconfig')
def install(self, spec, prefix):
python('setup.py', 'configure', '--hdf5=%s' % spec['hdf5'].prefix)
python('setup.py', 'install', '--prefix=%s' % prefix)
python('setup.py', 'configure',
'--hdf5={0}'.format(spec['hdf5'].prefix))
if '+mpi' in spec:
env['CC'] = spec['mpi'].mpicc
python('setup.py', 'configure', '--mpi')
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,46 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyIminuit(Package):
"""Interactive IPython-Friendly Minimizer based on SEAL Minuit2."""
homepage = "https://pypi.python.org/pypi/iminuit"
url = "https://pypi.python.org/packages/source/i/iminuit/iminuit-1.2.tar.gz"
version('1.2', '4701ec472cae42015e26251703e6e984')
# Required dependencies
extends('python')
depends_on('py-setuptools')
# Optional dependencies
depends_on('py-numpy')
depends_on('py-matplotlib')
depends_on('py-cython')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,44 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyNestle(Package):
"""Nested sampling algorithms for evaluating Bayesian evidence."""
homepage = "http://kbarbary.github.io/nestle/"
url = "https://pypi.python.org/packages/source/n/nestle/nestle-0.1.1.tar.gz"
version('0.1.1', '4875c0f9a0a8e263c1d7f5fa6ce604c5')
# Required dependencies
extends('python')
depends_on('py-numpy')
# Optional dependencies
depends_on('py-scipy')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,51 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PySncosmo(Package):
"""SNCosmo is a Python library for high-level supernova cosmology
analysis."""
homepage = "http://sncosmo.readthedocs.io/"
url = "https://pypi.python.org/packages/source/s/sncosmo/sncosmo-1.2.0.tar.gz"
version('1.2.0', '028e6d1dc84ab1c17d2f3b6378b2cb1e')
# Required dependencies
# py-sncosmo binaries are duplicates of those from py-astropy
extends('python', ignore=r'bin/.*')
depends_on('py-numpy')
depends_on('py-scipy')
depends_on('py-astropy')
# Recommended dependencies
depends_on('py-matplotlib')
depends_on('py-iminuit')
depends_on('py-emcee')
depends_on('py-nestle')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -0,0 +1,43 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class PyWcsaxes(Package):
"""WCSAxes is a framework for making plots of Astronomical data
in Matplotlib."""
homepage = "http://wcsaxes.readthedocs.io/en/latest/index.html"
url = "https://github.com/astrofrog/wcsaxes/archive/v0.8.tar.gz"
version('0.8', 'de1c60fdae4c330bf5ddb9f1ab5ab920')
extends('python', ignore=r'bin/pbr')
depends_on('py-numpy')
depends_on('py-matplotlib')
depends_on('py-astropy')
def install(self, spec, prefix):
python('setup.py', 'install', '--prefix={0}'.format(prefix))

View file

@ -22,9 +22,6 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import functools
import glob
import inspect
import os
import re
from contextlib import closing
@ -37,11 +34,10 @@
class Python(Package):
"""The Python programming language."""
homepage = "http://www.python.org"
url = "http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz"
extendable = True
version('3.5.1', 'be78e48cdfc1a7ad90efff146dce6cfe')
version('3.5.0', 'a56c0c0b45d75a0ec9c6dee933c41c36')
version('2.7.11', '6b6076ec9e93f05dd63e47eb9c15728b', preferred=True)
@ -49,6 +45,8 @@ class Python(Package):
version('2.7.9', '5eebcaa0030dc4061156d3429657fb83')
version('2.7.8', 'd4bca0159acb0b44a781292b5231936f')
extendable = True
depends_on("openssl")
depends_on("bzip2")
depends_on("readline")
@ -64,39 +62,63 @@ def install(self, spec, prefix):
# Rest of install is pretty standard except setup.py needs to
# be able to read the CPPFLAGS and LDFLAGS as it scans for the
# library and headers to build
configure_args= [
"--prefix=%s" % prefix,
cppflags = ' -I'.join([
spec['openssl'].prefix.include, spec['bzip2'].prefix.include,
spec['readline'].prefix.include, spec['ncurses'].prefix.include,
spec['sqlite'].prefix.include, spec['zlib'].prefix.include
])
ldflags = ' -L'.join([
spec['openssl'].prefix.lib, spec['bzip2'].prefix.lib,
spec['readline'].prefix.lib, spec['ncurses'].prefix.lib,
spec['sqlite'].prefix.lib, spec['zlib'].prefix.lib
])
config_args = [
"--prefix={0}".format(prefix),
"--with-threads",
"--enable-shared",
"CPPFLAGS=-I%s/include -I%s/include -I%s/include -I%s/include -I%s/include -I%s/include" % (
spec['openssl'].prefix, spec['bzip2'].prefix,
spec['readline'].prefix, spec['ncurses'].prefix,
spec['sqlite'].prefix, spec['zlib'].prefix),
"LDFLAGS=-L%s/lib -L%s/lib -L%s/lib -L%s/lib -L%s/lib -L%s/lib" % (
spec['openssl'].prefix, spec['bzip2'].prefix,
spec['readline'].prefix, spec['ncurses'].prefix,
spec['sqlite'].prefix, spec['zlib'].prefix)
"CPPFLAGS=-I{0}".format(cppflags),
"LDFLAGS=-L{0}".format(ldflags)
]
if spec.satisfies('@3:'):
configure_args.append('--without-ensurepip')
configure(*configure_args)
config_args.append('--without-ensurepip')
configure(*config_args)
make()
make("install")
# Modify compiler paths in configuration files. This is necessary for
# building site packages outside of spack
filter_file(r'([/s]=?)([\S=]*)/lib/spack/env(/[^\s/]*)?/(\S*)(\s)',
(r'\4\5'),
join_path(prefix.lib, 'python%d.%d' % self.version[:2], '_sysconfigdata.py'))
self.filter_compilers(spec, prefix)
python3_version = ''
def filter_compilers(self, spec, prefix):
"""Run after install to tell the configuration files and Makefiles
to use the compilers that Spack built the package with.
If this isn't done, they'll have CC and CXX set to Spack's generic
cc and c++. We want them to be bound to whatever compiler
they were built with."""
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
dirname = join_path(prefix.lib,
'python{0}'.format(self.version.up_to(2)))
config = 'config'
if spec.satisfies('@3:'):
python3_version = '-%d.%dm' % self.version[:2]
makefile_filepath = join_path(prefix.lib, 'python%d.%d' % self.version[:2], 'config%s' % python3_version, 'Makefile')
filter_file(r'([/s]=?)([\S=]*)/lib/spack/env(/[^\s/]*)?/(\S*)(\s)',
(r'\4\5'),
makefile_filepath)
config = 'config-{0}m'.format(self.version.up_to(2))
files = [
'_sysconfigdata.py',
join_path(config, 'Makefile')
]
for filename in files:
filter_file(env['CC'], self.compiler.cc,
join_path(dirname, filename), **kwargs)
filter_file(env['CXX'], self.compiler.cxx,
join_path(dirname, filename), **kwargs)
# ========================================================================
# Set up environment to make install easy for python extensions.
@ -104,57 +126,59 @@ def install(self, spec, prefix):
@property
def python_lib_dir(self):
return os.path.join('lib', 'python%d.%d' % self.version[:2])
return join_path('lib', 'python{0}'.format(self.version.up_to(2)))
@property
def python_include_dir(self):
return os.path.join('include', 'python%d.%d' % self.version[:2])
return join_path('include', 'python{0}'.format(self.version.up_to(2)))
@property
def site_packages_dir(self):
return os.path.join(self.python_lib_dir, 'site-packages')
return join_path(self.python_lib_dir, 'site-packages')
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
# TODO: do this only for actual extensions.
"""Set PYTHONPATH to include site-packages dir for the
extension and any other python extensions it depends on."""
# Set PYTHONPATH to include site-packages dir for the
# extension and any other python extensions it depends on.
python_paths = []
for d in extension_spec.traverse():
if d.package.extends(self.spec):
python_paths.append(os.path.join(d.prefix, self.site_packages_dir))
python_paths.append(join_path(d.prefix,
self.site_packages_dir))
pythonpath = ':'.join(python_paths)
spack_env.set('PYTHONPATH', pythonpath)
# For run time environment set only the path for extension_spec and prepend it to PYTHONPATH
# For run time environment set only the path for
# extension_spec and prepend it to PYTHONPATH
if extension_spec.package.extends(self.spec):
run_env.prepend_path('PYTHONPATH', os.path.join(extension_spec.prefix, self.site_packages_dir))
run_env.prepend_path('PYTHONPATH', join_path(
extension_spec.prefix, self.site_packages_dir))
def setup_dependent_package(self, module, ext_spec):
"""
Called before python modules' install() methods.
"""Called before python modules' install() methods.
In most cases, extensions will only need to have one line::
python('setup.py', 'install', '--prefix=%s' % prefix)
"""
python('setup.py', 'install', '--prefix={0}'.format(prefix))"""
# Python extension builds can have a global python executable function
if self.version >= Version("3.0.0") and self.version < Version("4.0.0"):
module.python = Executable(join_path(self.spec.prefix.bin, 'python3'))
if Version("3.0.0") <= self.version < Version("4.0.0"):
module.python = Executable(join_path(self.spec.prefix.bin,
'python3'))
else:
module.python = Executable(join_path(self.spec.prefix.bin, 'python'))
module.python = Executable(join_path(self.spec.prefix.bin,
'python'))
# Add variables for lib/pythonX.Y and lib/pythonX.Y/site-packages dirs.
module.python_lib_dir = os.path.join(ext_spec.prefix, self.python_lib_dir)
module.python_include_dir = os.path.join(ext_spec.prefix, self.python_include_dir)
module.site_packages_dir = os.path.join(ext_spec.prefix, self.site_packages_dir)
module.python_lib_dir = join_path(ext_spec.prefix,
self.python_lib_dir)
module.python_include_dir = join_path(ext_spec.prefix,
self.python_include_dir)
module.site_packages_dir = join_path(ext_spec.prefix,
self.site_packages_dir)
# Make the site packages directory for extensions, if it does not exist already.
# Make the site packages directory for extensions
if ext_spec.package.is_extension:
mkdirp(module.site_packages_dir)
@ -167,25 +191,28 @@ def python_ignore(self, ext_pkg, args):
ignore_arg = args.get('ignore', lambda f: False)
# Always ignore easy-install.pth, as it needs to be merged.
patterns = [r'easy-install\.pth$']
patterns = [r'site-packages/easy-install\.pth$']
# Ignore pieces of setuptools installed by other packages.
# Must include directory name or it will remove all site*.py files.
if ext_pkg.name != 'py-setuptools':
patterns.append(r'/site[^/]*\.pyc?$')
patterns.append(r'setuptools\.pth')
patterns.append(r'bin/easy_install[^/]*$')
patterns.append(r'setuptools.*egg$')
patterns.extend([
r'bin/easy_install[^/]*$',
r'site-packages/setuptools[^/]*\.egg$',
r'site-packages/setuptools\.pth$',
r'site-packages/site[^/]*\.pyc?$',
r'site-packages/__pycache__/site[^/]*\.pyc?$'
])
if ext_pkg.name != 'py-numpy':
patterns.append(r'bin/f2py$')
return match_predicate(ignore_arg, patterns)
def write_easy_install_pth(self, exts):
paths = []
for ext in sorted(exts.values()):
ext_site_packages = os.path.join(ext.prefix, self.site_packages_dir)
easy_pth = "%s/easy-install.pth" % ext_site_packages
ext_site_packages = join_path(ext.prefix, self.site_packages_dir)
easy_pth = join_path(ext_site_packages, "easy-install.pth")
if not os.path.isfile(easy_pth):
continue
@ -195,15 +222,18 @@ def write_easy_install_pth(self, exts):
line = line.rstrip()
# Skip lines matching these criteria
if not line: continue
if re.search(r'^(import|#)', line): continue
if (ext.name != 'py-setuptools' and
re.search(r'setuptools.*egg$', line)): continue
if not line:
continue
if re.search(r'^(import|#)', line):
continue
if ((ext.name != 'py-setuptools' and
re.search(r'setuptools.*egg$', line))):
continue
paths.append(line)
site_packages = os.path.join(self.prefix, self.site_packages_dir)
main_pth = "%s/easy-install.pth" % site_packages
site_packages = join_path(self.prefix, self.site_packages_dir)
main_pth = join_path(site_packages, "easy-install.pth")
if not paths:
if os.path.isfile(main_pth):
@ -211,12 +241,19 @@ def write_easy_install_pth(self, exts):
else:
with closing(open(main_pth, 'w')) as f:
f.write("import sys; sys.__plen = len(sys.path)\n")
f.write("""
import sys
sys.__plen = len(sys.path)
""")
for path in paths:
f.write("%s\n" % path)
f.write("import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; "
"p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)\n")
f.write("{0}\n".format(path))
f.write("""
new = sys.path[sys.__plen:]
del sys.path[sys.__plen:]
p = getattr(sys, '__egginsert', 0)
sys.path[p:p] = new
sys.__egginsert = p + len(new)
""")
def activate(self, ext_pkg, **args):
ignore = self.python_ignore(ext_pkg, args)
@ -228,12 +265,12 @@ def activate(self, ext_pkg, **args):
exts[ext_pkg.name] = ext_pkg.spec
self.write_easy_install_pth(exts)
def deactivate(self, ext_pkg, **args):
args.update(ignore=self.python_ignore(ext_pkg, args))
super(Python, self).deactivate(ext_pkg, **args)
exts = spack.install_layout.extension_map(self.spec)
if ext_pkg.name in exts: # Make deactivate idempotent.
# Make deactivate idempotent
if ext_pkg.name in exts:
del exts[ext_pkg.name]
self.write_easy_install_pth(exts)