diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/docs/build_systems/sippackage.rst | 34 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/sip.py | 62 |
2 files changed, 35 insertions, 61 deletions
diff --git a/lib/spack/docs/build_systems/sippackage.rst b/lib/spack/docs/build_systems/sippackage.rst index 710334f283..a4f52bf186 100644 --- a/lib/spack/docs/build_systems/sippackage.rst +++ b/lib/spack/docs/build_systems/sippackage.rst @@ -32,7 +32,7 @@ By default, these phases run: .. code-block:: console - $ python configure.py --bindir ... --destdir ... + $ sip-build --verbose --target-dir ... $ make $ make install @@ -41,30 +41,30 @@ By default, these phases run: Important files ^^^^^^^^^^^^^^^ -Each SIP package comes with a custom ``configure.py`` build script, -written in Python. This script contains instructions to build the project. +Each SIP package comes with a custom configuration file written in Python. +For newer packages, this is called ``project.py``, while in older packages, +it may be called ``configure.py``. This script contains instructions to build +the project. ^^^^^^^^^^^^^^^^^^^^^^^^^ Build system dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^ -``SIPPackage`` requires several dependencies. Python is needed to run -the ``configure.py`` build script, and to run the resulting Python -libraries. Qt is needed to provide the ``qmake`` command. SIP is also -needed to build the package. All of these dependencies are automatically -added via the base class +``SIPPackage`` requires several dependencies. Python and SIP are needed at build-time +to run the aforementioned configure script. Python is also needed at run-time to +actually use the installed Python library. And as we are building Python bindings +for C/C++ libraries, Python is also needed as a link dependency. All of these +dependencies are automatically added via the base class. .. code-block:: python - extends('python') + extends("python", type=("build", "link", "run")) + depends_on("py-sip", type="build") - depends_on('qt', type='build') - depends_on('py-sip', type='build') - -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Passing arguments to ``configure.py`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Passing arguments to ``sip-build`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Each phase comes with a ``<phase_args>`` function that can be used to pass arguments to that particular phase. For example, if you need to pass @@ -73,10 +73,10 @@ arguments to the configure phase, you can use: .. code-block:: python def configure_args(self): - return ['--no-python-dbus'] + return ["--no-python-dbus"] -A list of valid options can be found by running ``python configure.py --help``. +A list of valid options can be found by running ``sip-build --help``. ^^^^^^^ Testing diff --git a/lib/spack/spack/build_systems/sip.py b/lib/spack/spack/build_systems/sip.py index 3ec43f5f82..884c740d56 100644 --- a/lib/spack/spack/build_systems/sip.py +++ b/lib/spack/spack/build_systems/sip.py @@ -7,13 +7,14 @@ import os import re import llnl.util.tty as tty -from llnl.util.filesystem import find, join_path, working_dir +from llnl.util.filesystem import find, working_dir import spack.builder import spack.install_test import spack.package_base from spack.directives import build_system, depends_on, extends from spack.multimethod import when +from spack.util.executable import Executable from ._checks import BaseBuilder, execute_install_time_tests @@ -39,9 +40,8 @@ class SIPPackage(spack.package_base.PackageBase): build_system("sip") with when("build_system=sip"): - extends("python") - depends_on("qt") - depends_on("py-sip") + extends("python", type=("build", "link", "run")) + depends_on("py-sip", type="build") @property def import_modules(self): @@ -113,13 +113,13 @@ class SIPBuilder(BaseBuilder): * install The configure phase already adds a set of default flags. To see more - options, run ``python configure.py --help``. + options, run ``sip-build --help``. """ phases = ("configure", "build", "install") #: Names associated with package methods in the old build-system format - legacy_methods = ("configure_file", "configure_args", "build_args", "install_args") + legacy_methods = ("configure_args", "build_args", "install_args") #: Names associated with package attributes in the old build-system format legacy_attributes = ( @@ -130,34 +130,17 @@ class SIPBuilder(BaseBuilder): "build_directory", ) - def configure_file(self): - """Returns the name of the configure file to use.""" - return "configure.py" + build_directory = "build" def configure(self, pkg, spec, prefix): """Configure the package.""" - configure = self.configure_file() - - args = self.configure_args() - - args.extend( - [ - "--verbose", - "--confirm-license", - "--qmake", - spec["qt"].prefix.bin.qmake, - "--sip", - spec["py-sip"].prefix.bin.sip, - "--sip-incdir", - join_path(spec["py-sip"].prefix, spec["python"].package.include), - "--bindir", - prefix.bin, - "--destdir", - inspect.getmodule(self.pkg).python_platlib, - ] - ) - - self.pkg.python(configure, *args) + + # https://www.riverbankcomputing.com/static/Docs/sip/command_line_tools.html + args = ["--verbose", "--target-dir", inspect.getmodule(self.pkg).python_platlib] + args.extend(self.configure_args()) + + sip_build = Executable(spec["py-sip"].prefix.bin.join("sip-build")) + sip_build(*args) def configure_args(self): """Arguments to pass to configure.""" @@ -167,7 +150,8 @@ class SIPBuilder(BaseBuilder): """Build the package.""" args = self.build_args() - inspect.getmodule(self.pkg).make(*args) + with working_dir(self.build_directory): + inspect.getmodule(self.pkg).make(*args) def build_args(self): """Arguments to pass to build.""" @@ -177,21 +161,11 @@ class SIPBuilder(BaseBuilder): """Install the package.""" args = self.install_args() - inspect.getmodule(self.pkg).make("install", parallel=False, *args) + with working_dir(self.build_directory): + inspect.getmodule(self.pkg).make("install", *args) def install_args(self): """Arguments to pass to install.""" return [] spack.builder.run_after("install")(execute_install_time_tests) - - @spack.builder.run_after("install") - def extend_path_setup(self): - # See github issue #14121 and PR #15297 - module = self.pkg.spec["py-sip"].variants["module"].value - if module != "sip": - module = module.split(".")[0] - with working_dir(inspect.getmodule(self.pkg).python_platlib): - with open(os.path.join(module, "__init__.py"), "a") as f: - f.write("from pkgutil import extend_path\n") - f.write("__path__ = extend_path(__path__, __name__)\n") |