Files
spack/var/spack/repos/builtin/packages/py-charm4py/package.py
Adam J. Stewart 3540f8200a PythonPackage: install packages with pip (#27798)
* Use pip to bootstrap pip

* Bootstrap wheel from source

* Update PythonPackage to install using pip

* Update several packages

* Add wheel as base class dep

* Build phase no longer exists

* Add py-poetry package, fix py-flit-core bootstrapping

* Fix isort build

* Clean up many more packages

* Remove unused import

* Fix unit tests

* Don't directly run setup.py

* Typo fix

* Remove unused imports

* Fix issues caught by CI

* Remove custom setup.py file handling

* Use PythonPackage for installing wheels

* Remove custom phases in PythonPackages

* Remove <phase>_args methods

* Remove unused import

* Fix various packages

* Try to test Python packages directly in CI

* Actually run the pipeline

* Fix more packages

* Fix mappings, fix packages

* Fix dep version

* Work around bug in concretizer

* Various concretization fixes

* Fix gitlab yaml, packages

* Fix typo in gitlab yaml

* Skip more packages that fail to concretize

* Fix? jupyter ecosystem concretization issues

* Solve Jupyter concretization issues

* Prevent duplicate entries in PYTHONPATH

* Skip fenics-dolfinx

* Build fewer Python packages

* Fix missing npm dep

* Specify image

* More package fixes

* Add backends for every from-source package

* Fix version arg

* Remove GitLab CI stuff, add py-installer package

* Remove test deps, re-add install_options

* Function declaration syntax fix

* More build fixes

* Update spack create template

* Update PythonPackage documentation

* Fix documentation build

* Fix unit tests

* Remove pip flag added only in newer pip

* flux: add explicit dependency on jsonschema

* Update packages that have been added since this was branched off of develop

* Move Python 2 deprecation to a separate PR

* py-neurolab: add build dep on py-setuptools

* Use wheels for pip/wheel

* Allow use of pre-installed pip for external Python

* pip -> python -m pip

* Use python -m pip for all packages

* Fix py-wrapt

* Add both platlib and purelib to PYTHONPATH

* py-pyyaml: setuptools is needed for all versions

* py-pyyaml: link flags aren't needed

* Appease spack audit packages

* Some build backend is required for all versions, distutils -> setuptools

* Correctly handle different setup.py filename

* Use wheels for py-tomli to avoid circular dep on py-flit-core

* Fix busco installation procedure

* Clarify things in spack create template

* Test other Python build backends

* Undo changes to busco

* Various fixes

* Don't test other backends
2022-01-14 12:37:57 -06:00

69 lines
2.9 KiB
Python

# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCharm4py(PythonPackage):
"""Charm4py (Charm++ for Python) is a distributed computing and parallel
programming framework for Python, for the productive development of fast,
parallel and scalable applications. It is built on top of Charm++, a C++
adaptive runtime system that has seen extensive use in the scientific and
high-performance computing (HPC) communities across many disciplines, and
has been used to develop applications that run on a wide range of devices:
from small multi-core devices up to the largest supercomputers."""
homepage = "https://charmpy.readthedocs.io"
pypi = "charm4py/charm4py-1.0.tar.gz"
# Add a list of GitHub accounts to
# notify when the package is updated.
maintainers = ['payerle']
version('1.0', sha256='8ddb9f021b7379fde94b28c31f4ab6a60ced2c2a207a2d75ce57cb91b6be92bc')
variant('mpi', default=True,
description='build Charm++ library with the MPI instead of TCP'
' communication layer')
# Builds its own charm++, so no charmpp dependency
depends_on('python@2.7:2.8,3.4:', type=('build', 'run'))
depends_on('py-setuptools', type='build')
depends_on('py-cython', type='build')
depends_on('py-cffi@1.7:', type='build')
depends_on('py-numpy@1.10.0:', type=('build', 'run'))
depends_on('py-greenlet', type=('build', 'run'))
depends_on('cuda')
depends_on('mpi', when='+mpi')
# setup.py builds its own charm++, but libcharm.so
# ends up with a cuda dependency causing unresolved symbol errors
# when setup.py tries to load it to get version. We need to explicitly
# link libcudart when building the charm++ library.
# To do this, the following patch:
# 1) hacks setup.py to apply a patch to the charm++ Makefile
# causing the Makefile to include libcudart when building libcharm.so
# 2) inserts the patchfile needed to do so.
# This is convoluted, but best way I see since setup.py untars the
# charm++ sources and we need to patch a file that is in the tarball.
#
# The patch to the Makefile adds SPACK_CHARM4PY_EXTRALIBS to the link
# arguments. This needs to be set in the environment to be effective.
patch('py-charm4py.makefile.patch', when='@1.0')
# This sets the SPACK_CHARM4PY_EXTRALIBS env var which the
# py-charm4py.makefile.patch adds to the build/link command for
# libcharm.so.
def setup_build_environment(self, env):
env.set('SPACK_CHARM4PY_EXTRALIBS',
self.spec['cuda'].libs.ld_flags)
def install_options(self, spec, prefix):
args = []
if '+mpi' in spec:
args.append('--mpi')
return args