From 7699419fc12a087e145c41e00ffdd53b64420771 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Wed, 10 Oct 2018 10:07:51 -0700 Subject: new xdot.py package and necessary updates to GUI libs (#9179) * new xdot.py package and necessary updates to GUI libs * new xdot.py package and necessary updates to GUI libs --- .../repos/builtin/packages/at-spi2-core/package.py | 10 +++ .../repos/builtin/packages/gtkplus/package.py | 13 +++- var/spack/repos/builtin/packages/mesa/package.py | 5 ++ .../repos/builtin/packages/py-pycairo/package.py | 47 +++++++++++++ .../repos/builtin/packages/py-pygobject/package.py | 34 +++++++-- .../repos/builtin/packages/py-pygtk/package.py | 5 ++ .../repos/builtin/packages/py-xdot/package.py | 81 ++++++++++++++++++++++ 7 files changed, 186 insertions(+), 9 deletions(-) create mode 100644 var/spack/repos/builtin/packages/py-pycairo/package.py create mode 100644 var/spack/repos/builtin/packages/py-xdot/package.py diff --git a/var/spack/repos/builtin/packages/at-spi2-core/package.py b/var/spack/repos/builtin/packages/at-spi2-core/package.py index d3a639e194..1d7be5b7c2 100644 --- a/var/spack/repos/builtin/packages/at-spi2-core/package.py +++ b/var/spack/repos/builtin/packages/at-spi2-core/package.py @@ -41,8 +41,18 @@ class AtSpi2Core(MesonPackage): depends_on('dbus@1.12.8:') depends_on('libx11') depends_on('libxi') + depends_on('libxtst', type='build') + depends_on('recordproto', type='build') + depends_on('inputproto', type='build') + depends_on('fixesproto', type='build') + depends_on('pkgconfig', type='build') + depends_on('python', type='build') def url_for_version(self, version): """Handle gnome's version-based custom URLs.""" url = 'http://ftp.gnome.org/pub/gnome/sources/at-spi2-core' return url + '/%s/at-spi2-core-%s.tar.xz' % (version.up_to(2), version) + + def setup_environment(self, spack_env, run_env): + # this avoids an "import site" error in the build + spack_env.unset('PYTHONHOME') diff --git a/var/spack/repos/builtin/packages/gtkplus/package.py b/var/spack/repos/builtin/packages/gtkplus/package.py index 72d6501adb..844a2e1749 100644 --- a/var/spack/repos/builtin/packages/gtkplus/package.py +++ b/var/spack/repos/builtin/packages/gtkplus/package.py @@ -30,7 +30,7 @@ class Gtkplus(AutotoolsPackage): interfaces for applications.""" homepage = "http://www.gtk.org" url = "http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.31.tar.xz" - + version('3.20.10', 'e81da1af1c5c1fee87ba439770e17272fa5c06e64572939814da406859e56b70') version('2.24.32', 'b6c8a93ddda5eabe3bfee1eb39636c9a03d2a56c7b62828b359bf197943c582e') version('2.24.31', '68c1922732c7efc08df4656a5366dcc3afdc8791513400dac276009b40954658') version('2.24.25', '38af1020cb8ff3d10dda2c8807f11e92af9d2fa4045de61c62eedb7fbc7ea5b3') @@ -45,8 +45,17 @@ class Gtkplus(AutotoolsPackage): # see #6940 for rationale: depends_on('pango+X') depends_on('gobject-introspection') + depends_on('libepoxy', when='@3:') + depends_on('libxi', when='@3:') + depends_on('inputproto', when='@3:') + depends_on('fixesproto', when='@3:') + depends_on('at-spi2-atk', when='@3:') + + patch('no-demos.patch', when='@2:2.99') - patch('no-demos.patch') + def url_for_version(self, version): + url = 'http://ftp.gnome.org/pub/gnome/sources/gtk+' + return url + '/%s/gtk+-%s.tar.xz' % (version.up_to(2), version) def patch(self): # remove disable deprecated flag. diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py index ca63536c17..884d80857a 100644 --- a/var/spack/repos/builtin/packages/mesa/package.py +++ b/var/spack/repos/builtin/packages/mesa/package.py @@ -206,3 +206,8 @@ class Mesa(AutotoolsPackage): shared=True, recursive=False) if libs: return libs + + @when('^python@3:') + def setup_environment(self, spack_env, run_env): + # this avoids an "import site" error in the build + spack_env.unset('PYTHONHOME') diff --git a/var/spack/repos/builtin/packages/py-pycairo/package.py b/var/spack/repos/builtin/packages/py-pycairo/package.py new file mode 100644 index 0000000000..1a0885b6e3 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pycairo/package.py @@ -0,0 +1,47 @@ +############################################################################## +# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/spack/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * +import os + + +class PyPycairo(PythonPackage): + """Pycairo is a set of Python bindings for the cairo graphics library.""" + + homepage = "https://www.cairographics.org/pycairo/" + url = "https://github.com/pygobject/pycairo/releases/download/v1.17.1/pycairo-1.17.1.tar.gz" + url = "https://files.pythonhosted.org/packages/68/76/340ff847897296b2c8174dfa5a5ec3406e3ed783a2abac918cf326abad86/pycairo-1.17.1.tar.gz" + + version('1.17.1', '34c1ee106655b450c4bd57e29371a4a7') + + depends_on('cairo@1.2.0:') + depends_on('pkgconfig', type='build') + depends_on('py-setuptools', type='build') + + @run_after('install') + def post_install(self): + src = self.prefix.lib + '/pkgconfig/py3cairo.pc' + dst = self.prefix.lib + '/pkgconfig/pycairo.pc' + if os.path.exists(src) and not os.path.exists(dst): + copy(src, dst) diff --git a/var/spack/repos/builtin/packages/py-pygobject/package.py b/var/spack/repos/builtin/packages/py-pygobject/package.py index 2bf5235428..192a215bdb 100644 --- a/var/spack/repos/builtin/packages/py-pygobject/package.py +++ b/var/spack/repos/builtin/packages/py-pygobject/package.py @@ -25,24 +25,27 @@ from spack import * -class PyPygobject(AutotoolsPackage): +class PyPygobject(PythonPackage): """bindings for the GLib, and GObject, to be used in Python.""" homepage = "https://pypi.python.org/pypi/pygobject" - url = "http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.6.tar.bz2" - - version('2.28.6', 'a43d783228dd32899e6908352b8308f3') - version('2.28.3', 'aa64900b274c4661a5c32e52922977f9') + version('3.28.3', '3bac63c86bb963aa401f97859464aa90') + version('2.28.6', '9415cb7f2b3a847f2310ccea258b101e') + version('2.28.3', 'aa64900b274c4661a5c32e52922977f9', + url='http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.3.tar.bz2') extends('python') - depends_on('pkgconfig', type=('build')) + depends_on('py-setuptools', type=('build')) depends_on("libffi") depends_on('glib') - depends_on('py-py2cairo', type=('build', 'run')) + depends_on('python@2:2.99', when='@2:2.99', type=('build', 'run')) + depends_on('py-pycairo', type=('build', 'run'), when='@3:') + depends_on('py-py2cairo', type=('build', 'run'), when='@2:2.99') depends_on('gobject-introspection') + depends_on('gtkplus', when='@3:') patch('pygobject-2.28.6-introspection-1.patch', when='@2.28.3:2.28.6') @@ -50,5 +53,22 @@ class PyPygobject(AutotoolsPackage): # for https://bugzilla.gnome.org/show_bug.cgi?id=668522 patch('pygobject-2.28.6-gio-types-2.32.patch', when='@2.28.6') + def url_for_version(self, version): + url = 'http://ftp.gnome.org/pub/GNOME/sources/pygobject' + return url + '/%s/pygobject-%s.tar.xz' % (version.up_to(2), version) + + # pygobject version 2 requires an autotools build + @when('@2:2.99') + def build(self, spec, prefix): + configure('--prefix=%s' % spec.prefix) + + @when('@2:2.99') def install(self, spec, prefix): make('install', parallel=False) + + @when('^python@3:') + def patch(self): + filter_file( + r'Pycairo_IMPORT', + r'//Pycairo_IMPORT', + 'gi/pygi-foreign-cairo.c') diff --git a/var/spack/repos/builtin/packages/py-pygtk/package.py b/var/spack/repos/builtin/packages/py-pygtk/package.py index dca7275c98..4315c03e5f 100644 --- a/var/spack/repos/builtin/packages/py-pygtk/package.py +++ b/var/spack/repos/builtin/packages/py-pygtk/package.py @@ -37,6 +37,11 @@ class PyPygtk(AutotoolsPackage): depends_on('pkgconfig', type=('build')) depends_on("libffi") + # atk@2.28.1 depends on meson which requires python 3 + depends_on('atk@:2.20.0') + # PyGTK requires python 2 + # Use py-pygobject@3: for GTK bindings for python 3 + depends_on('python@2:2.99', type=('build', 'run')) depends_on('cairo') depends_on('glib') # for GTK 3.X use pygobject 3.X instead of pygtk diff --git a/var/spack/repos/builtin/packages/py-xdot/package.py b/var/spack/repos/builtin/packages/py-xdot/package.py new file mode 100644 index 0000000000..86a2d3a9b5 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-xdot/package.py @@ -0,0 +1,81 @@ +############################################################################## +# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/spack/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class PyXdot(PythonPackage): + """xdot.py is an interactive viewer for graphs written in Graphviz's + dot language.""" + + homepage = "https://github.com/jrfonseca/xdot.py" + url = "https://github.com/jrfonseca/xdot.py/archive/0.9.tar.gz" + git = "https://github.com/jrfonseca/xdot.py.git" + + version('master', branch="master") + version('0.9.1', commit="0fa629166989576b05d509c7ef0329c0f7655190") + version('0.9', '19c78311d73b0f9ea059a6febf42eeea') + + # setuptools is required at runtime to avoid: + # No module named 'pkg_resources' + depends_on('py-setuptools', type=('build', 'run')) + depends_on('python@3:', type=('build', 'run')) + depends_on('py-pygobject', type=('build', 'run')) + depends_on('py-pycairo', type=('build', 'run')) + depends_on('pango', type=('build', 'run')) + depends_on('atk', type=('build', 'run')) + depends_on('gdk-pixbuf', type=('build', 'run')) + depends_on('gtkplus', type=('build', 'run')) + + @run_after('install') + def post_install(self): + spec = self.spec + repo_paths = '%s:%s:%s:%s' % ( + join_path(spec['pango'].prefix.lib, 'girepository-1.0'), + join_path(spec['atk'].prefix.lib64, 'girepository-1.0'), + join_path(spec['gdk-pixbuf'].prefix.lib, 'girepository-1.0'), + join_path(spec['gtkplus'].prefix.lib, 'girepository-1.0')) + dst = join_path(spec.prefix, spec['python'].package.site_packages_dir, + 'xdot/__init__.py') + filter_file("import sys", + "import sys\nimport os\nos.environ['GI_TYPELIB_PATH']" + + " = '%s'" % repo_paths, dst) + # regenerate the byte-compiled __init__.py + python3 = spec['python'].command + python3('-m', 'compileall', dst) + + def setup_environment(self, spack_env, run_env): + spec = self.spec + run_env.prepend_path('GI_TYPELIB_PATH', + join_path(spec['pango'].prefix.lib, + 'girepository-1.0')) + run_env.prepend_path('GI_TYPELIB_PATH', + join_path(spec['atk'].prefix.lib64, + 'girepository-1.0')) + run_env.prepend_path('GI_TYPELIB_PATH', + join_path(spec['gdk-pixbuf'].prefix.lib, + 'girepository-1.0')) + run_env.prepend_path('GI_TYPELIB_PATH', + join_path(spec['gtkplus'].prefix.lib, + 'girepository-1.0')) -- cgit v1.2.3-60-g2f50