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
9ab8521a
Unverified
Commit
9ab8521a
authored
4 years ago
by
Adam J. Stewart
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Python: add spack external find support (#16684)
parent
512ef506
No related branches found
No related tags found
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
+76
-0
76 additions, 0 deletions
var/spack/repos/builtin/packages/python/package.py
with
76 additions
and
0 deletions
var/spack/repos/builtin/packages/python/package.py
+
76
−
0
View file @
9ab8521a
...
...
@@ -224,6 +224,75 @@ class Python(AutotoolsPackage):
# An in-source build with --enable-optimizations fails for python@3.X
build_directory
=
'
spack-build
'
executables
=
[
r
'
^python[\d.]*[mw]?$
'
]
@classmethod
def
determine_version
(
cls
,
exe
):
# Newer versions of Python support `--version`,
# but older versions only support `-V`
# Python 2 sends to STDERR, while Python 3 sends to STDOUT
# Output looks like:
# Python 3.7.7
output
=
Executable
(
exe
)(
'
-V
'
,
output
=
str
,
error
=
str
)
match
=
re
.
search
(
r
'
Python\s+(\S+)
'
,
output
)
return
match
.
group
(
1
)
if
match
else
None
@classmethod
def
determine_variants
(
cls
,
exes
,
version_str
):
python
=
Executable
(
exes
[
0
])
variants
=
''
for
module
in
[
'
readline
'
,
'
sqlite3
'
,
'
dbm
'
,
'
nis
'
,
'
zlib
'
,
'
bz2
'
,
'
lzma
'
,
'
ctypes
'
,
'
uuid
'
]:
try
:
python
(
'
-c
'
,
'
import
'
+
module
,
error
=
os
.
devnull
)
variants
+=
'
+
'
+
module
except
ProcessError
:
variants
+=
'
~
'
+
module
# Some variants enable multiple modules
try
:
python
(
'
-c
'
,
'
import ssl
'
,
error
=
os
.
devnull
)
python
(
'
-c
'
,
'
import hashlib
'
,
error
=
os
.
devnull
)
variants
+=
'
+ssl
'
except
ProcessError
:
variants
+=
'
~ssl
'
try
:
python
(
'
-c
'
,
'
import xml.parsers.expat
'
,
error
=
os
.
devnull
)
python
(
'
-c
'
,
'
import xml.etree.ElementTree
'
,
error
=
os
.
devnull
)
variants
+=
'
+pyexpat
'
except
ProcessError
:
variants
+=
'
~pyexpat
'
# Some modules changed names in Python 3
if
Version
(
version_str
)
>=
Version
(
'
3
'
):
try
:
python
(
'
-c
'
,
'
import tkinter
'
,
error
=
os
.
devnull
)
variants
+=
'
+tkinter
'
except
ProcessError
:
variants
+=
'
~tkinter
'
try
:
python
(
'
-c
'
,
'
import tkinter.tix
'
,
error
=
os
.
devnull
)
variants
+=
'
+tix
'
except
ProcessError
:
variants
+=
'
~tix
'
else
:
try
:
python
(
'
-c
'
,
'
import Tkinter
'
,
error
=
os
.
devnull
)
variants
+=
'
+tkinter
'
except
ProcessError
:
variants
+=
'
~tkinter
'
try
:
python
(
'
-c
'
,
'
import Tix
'
,
error
=
os
.
devnull
)
variants
+=
'
+tix
'
except
ProcessError
:
variants
+=
'
~tix
'
return
variants
def
url_for_version
(
self
,
version
):
url
=
"
https://www.python.org/ftp/python/{0}/Python-{1}.tgz
"
return
url
.
format
(
re
.
split
(
'
[a-z]
'
,
str
(
version
))[
0
],
version
)
...
...
@@ -606,6 +675,13 @@ def import_tests(self):
if
'
+uuid
'
in
spec
:
self
.
command
(
'
-c
'
,
'
import uuid
'
)
# Ensure that tix module works
if
'
+tix
'
in
spec
:
if
spec
.
satisfies
(
'
@3:
'
):
self
.
command
(
'
-c
'
,
'
import tkinter.tix
'
)
else
:
self
.
command
(
'
-c
'
,
'
import Tix
'
)
# ========================================================================
# Set up environment to make install easy for python extensions.
# ========================================================================
...
...
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