patches: clean up patch.py, directives, and package class properties

- cleanup patch.py:
  - make patch.py constructors more understandable
  - loosen coupling of patch.py with package

- in Package: make package_dir, module, and namespace class properties

  - These were previously instance properties and couldn't be called from
    directives, e.g. in patch.create()

  - make them class properties so that they can be used in class definition

  - also add some instance properties to delegate to class properties so
    that prior usage on Package objects still works
This commit is contained in:
Todd Gamblin
2018-12-16 23:17:23 -08:00
parent 19b7b15929
commit 527ff860f0
7 changed files with 119 additions and 101 deletions

View File

@@ -7,7 +7,6 @@
import os
import subprocess
import llnl.util.tty as tty
from spack.patch import absolute_path_for_package
class Catalyst(CMakePackage):
@@ -18,7 +17,7 @@ class Catalyst(CMakePackage):
homepage = 'http://www.paraview.org'
url = "http://www.paraview.org/files/v5.5/ParaView-v5.5.2.tar.gz"
_urlfmt_gz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.gz'
_urlfmt_xz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.xz'
_urlfmt_xz = 'http://www.paraview.org/files/v{0}/ParaView-v{1}{2}.tar.xz'
version('5.5.2', '7eb93c31a1e5deb7098c3b4275e53a4a')
version('5.5.1', 'a7d92a45837b67c3371006cc45163277')
@@ -52,11 +51,10 @@ def patch(self):
at the package dir to the source code in
root_cmakelists_dir."""
patch_name = 'vtkm-catalyst-pv551.patch'
pkg_dir = os.path.dirname(absolute_path_for_package(self))
patch = which("patch", required=True)
with working_dir(self.root_cmakelists_dir):
patch('-s', '-p', '1', '-i',
join_path(pkg_dir, patch_name),
join_path(self.package_dir, patch_name),
"-d", '.')
def url_for_version(self, version):