Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ebrains-spack-builds
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klaus Noelp
ebrains-spack-builds
Commits
aea50674
Commit
aea50674
authored
1 year ago
by
Eric Müller
Browse files
Options
Downloads
Patches
Plain Diff
feat(BSS-2): cleanup env handling during build
parent
bc57b50b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/hxtorch/package.py
+33
-18
33 additions, 18 deletions
packages/hxtorch/package.py
packages/pynn-brainscales/package.py
+33
-18
33 additions, 18 deletions
packages/pynn-brainscales/package.py
with
66 additions
and
36 deletions
packages/hxtorch/package.py
+
33
−
18
View file @
aea50674
...
...
@@ -5,6 +5,8 @@
import
os
from
spack
import
*
from
spack.util.environment
import
EnvironmentModifications
import
spack.build_environment
class
Hxtorch
(
WafPackage
):
...
...
@@ -71,8 +73,37 @@ class Hxtorch(WafPackage):
dep
=
self
.
spec
[
ppu_dep_name
]
dep_include_dirs
=
set
(
dep
.
headers
.
directories
)
ppu_include_dirs
.
extend
(
list
(
dep_include_dirs
))
env
.
set
(
'
C_INCLUDE_PATH
'
,
'
:
'
.
join
(
ppu_include_dirs
))
env
.
set
(
'
CPLUS_INCLUDE_PATH
'
,
'
:
'
.
join
(
ppu_include_dirs
))
for
dir
in
reversed
(
ppu_include_dirs
):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
def
setup_build_environment
(
self
,
env
):
my_envmod
=
EnvironmentModifications
(
env
)
spack
.
build_environment
.
set_wrapper_variables
(
self
,
my_envmod
)
my_env
=
{}
my_envmod
.
apply_modifications
(
my_env
)
def
get_path
(
env
,
name
):
path
=
env
.
get
(
name
,
""
).
strip
()
if
path
:
return
path
.
split
(
os
.
pathsep
)
return
[]
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
if
'
SPACK_INCLUDE_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_INCLUDE_DIRS
"
)):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
if
'
SPACK_LINK_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_LINK_DIRS
"
)):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
for
dir
in
reversed
(
self
.
compiler
.
implicit_rpaths
()):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
# technically this is probably not needed for the non-configure steps
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
def
setup_dependent_build_environment
(
self
,
env
,
dependent_spec
):
self
.
_setup_common_env
(
env
)
...
...
@@ -87,20 +118,6 @@ class Hxtorch(WafPackage):
def
configure
(
self
,
spec
,
prefix
):
"""
Setup and configure the project.
"""
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
env
=
os
.
environ
if
'
SPACK_INCLUDE_DIRS
'
in
env
:
env
[
'
C_INCLUDE_PATH
'
]
=
env
[
'
SPACK_INCLUDE_DIRS
'
]
env
[
'
CPLUS_INCLUDE_PATH
'
]
=
env
[
'
SPACK_INCLUDE_DIRS
'
]
if
'
SPACK_LINK_DIRS
'
in
env
:
env
[
'
LIBRARY_PATH
'
]
=
env
[
'
SPACK_LINK_DIRS
'
]
env
[
'
LD_LIBRARY_PATH
'
]
=
env
[
'
SPACK_LINK_DIRS
'
]
if
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
in
env
:
env
[
'
LIBRARY_PATH
'
]
=
env
[
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
]
+
'
:
'
+
env
[
'
LIBRARY_PATH
'
]
env
[
'
WAF_CONFIGURE_LD_LIBRARY_PATH
'
]
=
env
[
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
]
+
'
:
'
+
env
[
'
LD_LIBRARY_PATH
'
]
self
.
waf
(
'
setup
'
,
'
--repo-db-url=https://github.com/electronicvisions/projects
'
,
'
--without-munge
'
,
'
--without-hxcomm-hostarq
'
,
...
...
@@ -111,8 +128,6 @@ class Hxtorch(WafPackage):
args
=
[
'
--prefix={0}
'
.
format
(
self
.
prefix
)]
args
+=
self
.
configure_args
()
env
[
'
LD_LIBRARY_PATH
'
]
=
env
.
get
(
'
WAF_CONFIGURE_LD_LIBRARY_PATH
'
)
self
.
waf
(
'
configure
'
,
'
--build-profile=release
'
,
'
--disable-doxygen
'
,
*
args
)
def
build_args
(
self
):
...
...
This diff is collapsed.
Click to expand it.
packages/pynn-brainscales/package.py
+
33
−
18
View file @
aea50674
...
...
@@ -5,6 +5,8 @@
import
os
from
spack
import
*
from
spack.util.environment
import
EnvironmentModifications
import
spack.build_environment
class
PynnBrainscales
(
WafPackage
):
...
...
@@ -68,8 +70,37 @@ class PynnBrainscales(WafPackage):
dep
=
self
.
spec
[
ppu_dep_name
]
dep_include_dirs
=
set
(
dep
.
headers
.
directories
)
ppu_include_dirs
.
extend
(
list
(
dep_include_dirs
))
env
.
set
(
'
C_INCLUDE_PATH
'
,
'
:
'
.
join
(
ppu_include_dirs
))
env
.
set
(
'
CPLUS_INCLUDE_PATH
'
,
'
:
'
.
join
(
ppu_include_dirs
))
for
dir
in
reversed
(
ppu_include_dirs
):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
def
setup_build_environment
(
self
,
env
):
my_envmod
=
EnvironmentModifications
(
env
)
spack
.
build_environment
.
set_wrapper_variables
(
self
,
my_envmod
)
my_env
=
{}
my_envmod
.
apply_modifications
(
my_env
)
def
get_path
(
env
,
name
):
path
=
env
.
get
(
name
,
""
).
strip
()
if
path
:
return
path
.
split
(
os
.
pathsep
)
return
[]
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
if
'
SPACK_INCLUDE_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_INCLUDE_DIRS
"
)):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
if
'
SPACK_LINK_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_LINK_DIRS
"
)):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
for
dir
in
reversed
(
self
.
compiler
.
implicit_rpaths
()):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
# technically this is probably not needed for the non-configure steps
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
def
setup_dependent_build_environment
(
self
,
env
,
dependent_spec
):
self
.
_setup_common_env
(
env
)
...
...
@@ -84,20 +115,6 @@ class PynnBrainscales(WafPackage):
def
configure
(
self
,
spec
,
prefix
):
"""
Setup and configure the project.
"""
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
env
=
os
.
environ
if
'
SPACK_INCLUDE_DIRS
'
in
env
:
env
[
'
C_INCLUDE_PATH
'
]
=
env
[
'
SPACK_INCLUDE_DIRS
'
]
env
[
'
CPLUS_INCLUDE_PATH
'
]
=
env
[
'
SPACK_INCLUDE_DIRS
'
]
if
'
SPACK_LINK_DIRS
'
in
env
:
env
[
'
LIBRARY_PATH
'
]
=
env
[
'
SPACK_LINK_DIRS
'
]
env
[
'
LD_LIBRARY_PATH
'
]
=
env
[
'
SPACK_LINK_DIRS
'
]
if
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
in
env
:
env
[
'
LIBRARY_PATH
'
]
=
env
[
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
]
+
'
:
'
+
env
[
'
LIBRARY_PATH
'
]
env
[
'
WAF_CONFIGURE_LD_LIBRARY_PATH
'
]
=
env
[
'
SPACK_COMPILER_IMPLICIT_RPATHS
'
]
+
'
:
'
+
env
[
'
LD_LIBRARY_PATH
'
]
self
.
waf
(
'
setup
'
,
'
--repo-db-url=https://github.com/electronicvisions/projects
'
,
'
--without-munge
'
,
'
--without-hxcomm-hostarq
'
,
...
...
@@ -108,8 +125,6 @@ class PynnBrainscales(WafPackage):
args
=
[
'
--prefix={0}
'
.
format
(
self
.
prefix
)]
args
+=
self
.
configure_args
()
env
[
'
LD_LIBRARY_PATH
'
]
=
env
.
get
(
'
WAF_CONFIGURE_LD_LIBRARY_PATH
'
)
self
.
waf
(
'
configure
'
,
'
--build-profile=release
'
,
'
--disable-doxygen
'
,
*
args
)
def
build_args
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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