Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
bcccf020
Commit
bcccf020
authored
10 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Add setup_extension_environment() method.
- lets packages do some setup before their extensions run install()
parent
82946d29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/spack/spack/package.py
+30
-0
30 additions, 0 deletions
lib/spack/spack/package.py
var/spack/packages/py-setuptools/package.py
+0
-6
0 additions, 6 deletions
var/spack/packages/py-setuptools/package.py
var/spack/packages/python/package.py
+22
-1
22 additions, 1 deletion
var/spack/packages/python/package.py
with
52 additions
and
7 deletions
lib/spack/spack/package.py
+
30
−
0
View file @
bcccf020
...
...
@@ -783,6 +783,12 @@ def do_install(self, **kwargs):
self
.
stage
.
chdir_to_source
()
build_env
.
setup_package
(
self
)
# Allow extendees to further set up the environment.
for
ext_name
in
self
.
extendees
:
ext_spec
=
self
.
spec
[
ext_name
]
ext_spec
.
package
.
setup_extension_environment
(
self
.
module
,
ext_spec
,
self
.
spec
)
if
fake_install
:
self
.
do_fake_install
()
else
:
...
...
@@ -854,6 +860,30 @@ def module(self):
fromlist
=
[
self
.
__class__
.
__name__
])
def
setup_extension_environment
(
self
,
module
,
spec
,
ext_spec
):
"""
Called before the install() method of extensions.
Default implementation does nothing, but this can be
overridden by an extendable package to set up the install
environment for its extensions. This is useful if there are
some common steps to installing all extensions for a
certain package.
Some examples:
1. Installing python modules generally requires PYTHONPATH to
point to the lib/pythonX.Y/site-packages directory in the
module
'
s install prefix. This could set that variable.
2. Extensions often need to invoke the
'
python
'
interpreter
from the Python installation being extended. This routine can
put a
'
python
'
Execuable object in the module scope for the
extension package to simplify extension installs.
"""
pass
def
install
(
self
,
spec
,
prefix
):
"""
Package implementations override this with their own build configuration.
"""
raise
InstallError
(
"
Package %s provides no install method!
"
%
self
.
name
)
...
...
This diff is collapsed.
Click to expand it.
var/spack/packages/py-setuptools/package.py
+
0
−
6
View file @
bcccf020
...
...
@@ -10,10 +10,4 @@ class PySetuptools(Package):
extends
(
'
python
'
)
def
install
(
self
,
spec
,
prefix
):
site_packages_dir
=
"
%s/lib/python2.7/site-packages
"
%
prefix
mkdirp
(
site_packages_dir
)
env
[
'
PYTHONPATH
'
]
=
site_packages_dir
python
=
which
(
'
python
'
)
python
(
'
setup.py
'
,
'
install
'
,
'
--prefix=%s
'
%
prefix
)
This diff is collapsed.
Click to expand it.
var/spack/packages/python/package.py
+
22
−
1
View file @
bcccf020
from
spack
import
*
import
os
class
Python
(
Package
):
"""
The Python programming language.
"""
...
...
@@ -26,3 +26,24 @@ def install(self, spec, prefix):
"
--enable-shared
"
)
make
()
make
(
"
install
"
)
def
setup_extension_environment
(
self
,
module
,
spec
,
ext_spec
):
"""
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 extension builds can have a global python executable function
module
.
python
=
Executable
(
join_path
(
spec
.
prefix
.
bin
,
'
python
'
))
# Add variables for lib/pythonX.Y and lib/pythonX.Y/site-packages dirs.
module
.
python_lib_dir
=
join_path
(
ext_spec
.
prefix
.
lib
,
'
python%d.%d
'
%
self
.
version
[:
2
])
module
.
site_packages_dir
=
join_path
(
module
.
python_lib_dir
,
'
site-packages
'
)
# Add site packages directory to the PYTHONPATH
os
.
environ
[
'
PYTHONPATH
'
]
=
module
.
site_packages_dir
# Make the site packages directory if it does not exist already.
mkdirp
(
module
.
site_packages_dir
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment