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
fb2d2303
Commit
fb2d2303
authored
8 years ago
by
Joseph Ciurej
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug that was causing Python installs to be affected by user config.
parent
098af179
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
var/spack/repos/builtin/packages/python/package.py
+31
-9
31 additions, 9 deletions
var/spack/repos/builtin/packages/python/package.py
with
31 additions
and
9 deletions
var/spack/repos/builtin/packages/python/package.py
+
31
−
9
View file @
fb2d2303
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
from
contextlib
import
closing
from
contextlib
import
closing
import
spack
import
spack
import
llnl.util.tty
as
tty
from
llnl.util.lang
import
match_predicate
from
llnl.util.lang
import
match_predicate
from
spack
import
*
from
spack
import
*
from
spack.util.environment
import
*
from
spack.util.environment
import
*
...
@@ -72,9 +73,29 @@ class Python(Package):
...
@@ -72,9 +73,29 @@ class Python(Package):
depends_on
(
"
tk
"
,
when
=
"
+tk
"
)
depends_on
(
"
tk
"
,
when
=
"
+tk
"
)
depends_on
(
"
tcl
"
,
when
=
"
+tk
"
)
depends_on
(
"
tcl
"
,
when
=
"
+tk
"
)
@when
(
'
@2.7,3.4:
'
)
def
patch
(
self
):
# NOTE: Python's default installation procedure makes it possible for a
# user's local configurations to change the Spack installation. In
# order to prevent this behavior for a full installation, we must
# modify the installation script so that it ignores user files.
ff
=
FileFilter
(
'
Makefile.pre.in
'
)
ff
.
filter
(
r
'
^(.*)setup\.py(.*)((build)|(install))(.*)$
'
,
r
'
\1setup.py\2 --no-user-cfg \3\6
'
)
def
install
(
self
,
spec
,
prefix
):
def
install
(
self
,
spec
,
prefix
):
# TODO: The '--no-user-cfg' option for Python installation is only in
# Python v2.7 and v3.4+ (see https://bugs.python.org/issue1180) and
# adding support for ignoring user configuration will require
# significant changes to this package for other Python versions.
if
not
spec
.
satisfies
(
'
@2.7,3.4:
'
):
tty
.
warn
((
'
Python v{0} may not install properly if Python
'
'
user configurations are present.
'
).
format
(
self
.
version
))
# Need this to allow python build to find the Python installation.
# Need this to allow python build to find the Python installation.
env
[
'
PYTHONHOME
'
]
=
prefix
env
[
'
PYTHONHOME
'
]
,
env
[
'
PYTHONPATH
'
]
=
prefix
,
prefix
env
[
'
MACOSX_DEPLOYMENT_TARGET
'
]
=
'
10.6
'
env
[
'
MACOSX_DEPLOYMENT_TARGET
'
]
=
'
10.6
'
# Rest of install is pretty standard except setup.py needs to
# Rest of install is pretty standard except setup.py needs to
...
@@ -193,6 +214,8 @@ def site_packages_dir(self):
...
@@ -193,6 +214,8 @@ def site_packages_dir(self):
def
setup_dependent_environment
(
self
,
spack_env
,
run_env
,
extension_spec
):
def
setup_dependent_environment
(
self
,
spack_env
,
run_env
,
extension_spec
):
"""
Set PYTHONPATH to include site-packages dir for the
"""
Set PYTHONPATH to include site-packages dir for the
extension and any other python extensions it depends on.
"""
extension and any other python extensions it depends on.
"""
pythonhome
=
self
.
prefix
spack_env
.
set
(
'
PYTHONHOME
'
,
pythonhome
)
python_paths
=
[]
python_paths
=
[]
for
d
in
extension_spec
.
traverse
(
deptype
=
nolink
,
deptype_query
=
'
run
'
):
for
d
in
extension_spec
.
traverse
(
deptype
=
nolink
,
deptype_query
=
'
run
'
):
...
@@ -214,15 +237,14 @@ def setup_dependent_package(self, module, ext_spec):
...
@@ -214,15 +237,14 @@ def setup_dependent_package(self, module, ext_spec):
In most cases, extensions will only need to have one line::
In most cases, extensions will only need to have one line::
python(
'
setup.py
'
,
'
install
'
,
'
--prefix={0}
'
.format(prefix))
"""
setup_py(
'
install
'
,
'
--prefix={0}
'
.format(prefix))
"""
python_path
=
join_path
(
self
.
spec
.
prefix
.
bin
,
'
python{0}
'
.
format
(
'
3
'
if
self
.
spec
.
satisfies
(
'
@3
'
)
else
''
)
)
# Python extension builds can have a global python executable function
module
.
python
=
Executable
(
python_path
)
if
Version
(
"
3.0.0
"
)
<=
self
.
version
<
Version
(
"
4.0.0
"
):
module
.
setup_py
=
Executable
(
python_path
+
'
setup.py --no-user-cfg
'
)
module
.
python
=
Executable
(
join_path
(
self
.
spec
.
prefix
.
bin
,
'
python3
'
))
else
:
module
.
python
=
Executable
(
join_path
(
self
.
spec
.
prefix
.
bin
,
'
python
'
))
# Add variables for lib/pythonX.Y and lib/pythonX.Y/site-packages dirs.
# Add variables for lib/pythonX.Y and lib/pythonX.Y/site-packages dirs.
module
.
python_lib_dir
=
join_path
(
ext_spec
.
prefix
,
module
.
python_lib_dir
=
join_path
(
ext_spec
.
prefix
,
...
...
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