Browse code

Updated pygobject

Change-Id: I01c070d86281ca61b77eb9c2ffd94460d24e41d4
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5814
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Tapas Kundu authored on 2018/09/28 22:06:18
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,175 @@
0
+--- a/setup.py	2018-10-01 17:55:11.130750445 +0530
1
+@@ -45,6 +45,9 @@ GI_VERSION_REQUIRED = "1.46.0"
2
+ PYCAIRO_VERSION_REQUIRED = "1.11.1"
3
+ LIBFFI_VERSION_REQUIRED = "3.0"
4
+ 
5
++WITH_CAIRO = False
6
++"""Set to false if you don't want to build with cairo/pycairo support"""
7
++
8
+ 
9
+ def is_dev_version():
10
+     version = tuple(map(int, PYGOBJECT_VERISON.split(".")))
11
+@@ -455,7 +458,8 @@ class build_tests(Command):
12
+                 objects = compiler.compile(
13
+                     ext.sources,
14
+                     output_dir=self.build_temp,
15
+-                    include_dirs=ext.include_dirs)
16
++                    include_dirs=ext.include_dirs,
17
++                    macros=ext.define_macros)
18
+ 
19
+                 if os.name == "nt":
20
+                     postargs = ["-Wl,--out-implib=%s" %
21
+@@ -523,6 +527,10 @@ class build_tests(Command):
22
+                 "--output=%s" % typelib_path,
23
+             ])
24
+ 
25
++        regress_macros = []
26
++        if not WITH_CAIRO:
27
++            regress_macros.append(("_GI_DISABLE_CAIRO", "1"))
28
++
29
+         ext = Extension(
30
+             name='libregress',
31
+             sources=[
32
+@@ -536,21 +544,29 @@ class build_tests(Command):
33
+                 os.path.join(gi_tests_dir, "regress.h"),
34
+                 os.path.join(tests_dir, "regressextra.h"),
35
+             ],
36
++            define_macros=regress_macros,
37
+         )
38
+         add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0")
39
+         add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0")
40
+-        add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo")
41
+-        add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo-gobject")
42
++        if WITH_CAIRO:
43
++            add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo")
44
++            add_ext_pkg_config_dep(
45
++                ext, compiler.compiler_type, "cairo-gobject")
46
+         ext_paths = build_ext(ext)
47
+ 
48
+         gir_path = os.path.join(tests_dir, "Regress-1.0.gir")
49
+         typelib_path = os.path.join(tests_dir, "Regress-1.0.typelib")
50
+ 
51
++        if WITH_CAIRO:
52
++            gir_cairo_args = [
53
++                "--include=cairo-1.0", "--pkg=cairo", "--pkg=cairo-gobject"]
54
++        else:
55
++            gir_cairo_args = ["-D_GI_DISABLE_CAIRO"]
56
++
57
+         if self._newer_group(ext_paths, gir_path):
58
+             subprocess.check_call([
59
+                 g_ir_scanner,
60
+                 "--no-libtool",
61
+-                "--include=cairo-1.0",
62
+                 "--include=Gio-2.0",
63
+                 "--namespace=Regress",
64
+                 "--nsversion=1.0",
65
+@@ -560,10 +576,8 @@ class build_tests(Command):
66
+                 "--library=regress",
67
+                 "--pkg=glib-2.0",
68
+                 "--pkg=gio-2.0",
69
+-                "--pkg=cairo",
70
+-                "--pkg=cairo-gobject",
71
+                 "--output=%s" % gir_path,
72
+-            ] + ext.sources + ext.depends)
73
++            ] + gir_cairo_args + ext.sources + ext.depends)
74
+ 
75
+         if self._newer_group([gir_path], typelib_path):
76
+             subprocess.check_call([
77
+@@ -589,7 +603,6 @@ class build_tests(Command):
78
+         )
79
+         add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0")
80
+         add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0")
81
+-        add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo")
82
+         add_ext_compiler_flags(ext, compiler)
83
+ 
84
+         dist = Distribution({"ext_modules": [ext]})
85
+@@ -1009,15 +1022,16 @@ class build_ext(du_build_ext):
86
+         add_dependency(gi_ext, "libffi")
87
+         add_ext_compiler_flags(gi_ext, compiler)
88
+ 
89
+-        gi_cairo_ext = ext["gi._gi_cairo"]
90
+-        add_dependency(gi_cairo_ext, "glib-2.0")
91
+-        add_dependency(gi_cairo_ext, "gio-2.0")
92
+-        add_dependency(gi_cairo_ext, "gobject-introspection-1.0")
93
+-        add_dependency(gi_cairo_ext, "libffi")
94
+-        add_dependency(gi_cairo_ext, "cairo")
95
+-        add_dependency(gi_cairo_ext, "cairo-gobject")
96
+-        add_pycairo(gi_cairo_ext)
97
+-        add_ext_compiler_flags(gi_cairo_ext, compiler)
98
++        if WITH_CAIRO:
99
++            gi_cairo_ext = ext["gi._gi_cairo"]
100
++            add_dependency(gi_cairo_ext, "glib-2.0")
101
++            add_dependency(gi_cairo_ext, "gio-2.0")
102
++            add_dependency(gi_cairo_ext, "gobject-introspection-1.0")
103
++            add_dependency(gi_cairo_ext, "libffi")
104
++            add_dependency(gi_cairo_ext, "cairo")
105
++            add_dependency(gi_cairo_ext, "cairo-gobject")
106
++            add_pycairo(gi_cairo_ext)
107
++            add_ext_compiler_flags(gi_cairo_ext, compiler)
108
+ 
109
+     def run(self):
110
+         self._write_config_h()
111
+@@ -1119,6 +1133,9 @@ def main():
112
+     with io.open(readme, encoding="utf-8") as h:
113
+         long_description = h.read()
114
+ 
115
++    ext_modules = []
116
++    install_requires = []
117
++
118
+     gi_ext = Extension(
119
+         name='gi._gi',
120
+         sources=sources,
121
+@@ -1126,14 +1143,20 @@ def main():
122
+         depends=list_headers(script_dir) + list_headers(gi_dir),
123
+         define_macros=[("PY_SSIZE_T_CLEAN", None)],
124
+     )
125
++    ext_modules.append(gi_ext)
126
+ 
127
+-    gi_cairo_ext = Extension(
128
+-        name='gi._gi_cairo',
129
+-        sources=cairo_sources,
130
+-        include_dirs=[script_dir, gi_dir],
131
+-        depends=list_headers(script_dir) + list_headers(gi_dir),
132
+-        define_macros=[("PY_SSIZE_T_CLEAN", None)],
133
+-    )
134
++    if WITH_CAIRO:
135
++        gi_cairo_ext = Extension(
136
++            name='gi._gi_cairo',
137
++            sources=cairo_sources,
138
++            include_dirs=[script_dir, gi_dir],
139
++            depends=list_headers(script_dir) + list_headers(gi_dir),
140
++            define_macros=[("PY_SSIZE_T_CLEAN", None)],
141
++        )
142
++        ext_modules.append(gi_cairo_ext)
143
++        install_requires.append(
144
++            "pycairo>=%s" % get_version_requirement(
145
++                get_pycairo_pkg_config_name()))
146
+ 
147
+     version = pkginfo["Version"]
148
+     if is_dev_version():
149
+@@ -1160,10 +1183,8 @@ def main():
150
+             "gi.repository",
151
+             "gi.overrides",
152
+         ],
153
+-        ext_modules=[
154
+-            gi_ext,
155
+-            gi_cairo_ext,
156
+-        ],
157
++        ext_modules=ext_modules,
158
++        
159
+         cmdclass={
160
+             "build_ext": build_ext,
161
+             "distcheck": distcheck,
162
+@@ -1174,10 +1195,7 @@ def main():
163
+             "install": install,
164
+             "install_pkgconfig": install_pkgconfig,
165
+         },
166
+-        install_requires=[
167
+-            "pycairo>=%s" % get_version_requirement(
168
+-                get_pycairo_pkg_config_name()),
169
+-        ],
170
++        install_requires=install_requires,
171
+         data_files=[
172
+             ('include/pygobject-3.0', ['gi/pygobject.h']),
173
+         ],
... ...
@@ -1,24 +1,7 @@
1
-diff --git a/tests/runtests.py b/tests/runtests.py.1
2
-index 6085ff9..df69e68 100755
3
-+++ b/tests/runtests.py.1
4
-@@ -50,6 +50,10 @@ else:
5
-     names = []
6
-     for filename in glob.iglob(os.path.join(mydir, 'test_*.py')):
7
-         names.append(os.path.basename(filename)[:-3])
8
-+    names.remove('test_fields')
9
-+    names.remove('test_everything')
10
-+    names.remove('test_signal')
11
-+    names.remove('test_resulttuple')
12
- 
13
- loader = unittest.TestLoader()
14
- suite = loader.loadTestsFromNames(names)
15
-diff --git a/tests/test_error.py b/tests/test_error.py.1
16
-index 5702490..ce85f03 100644
17
-+++ b/tests/test_error.py.1
18
-@@ -25,6 +25,8 @@
19
- import unittest
1
+--- a/tests/test_error.py	2018-09-29 00:32:59.220553524 +0530
2
+@@ -28,6 +28,8 @@ import unittest
3
+ import pickle
20 4
  
21 5
  from gi.repository import GLib
22 6
 +import gi
... ...
@@ -26,23 +9,20 @@ index 5702490..ce85f03 100644
26 26
  from gi.repository import GIMarshallingTests
27 27
  
28 28
  
29
-diff --git a/tests/test_gi.py b/tests/test_gi.py.1
30
-index d0c72b6..7e2fc46 100644
31
-+++ b/tests/test_gi.py.1
32
-@@ -1475,6 +1475,7 @@ class TestPointer(unittest.TestCase):
29
+--- a/tests/test_gi.py	2018-09-29 00:34:17.392556911 +0530
30
+@@ -1783,7 +1783,7 @@ class TestPointer(unittest.TestCase):
31
+     def test_pointer_in_return(self):
33 32
          self.assertEqual(GIMarshallingTests.pointer_in_return(42), 42)
34 33
  
35
- 
34
+-
36 35
 +@unittest.skip("disabled photon build")
37 36
  class TestEnum(unittest.TestCase):
38 37
  
39
-     @classmethod
40
-diff --git a/tests/test_gtype.py b/tests/test_gtype.py.1
41
-index 8099101..0d7f33f 100644
42
-+++ b/tests/test_gtype.py.1
43
-@@ -1,6 +1,8 @@
38
+     def test_enum(self):
39
+--- a/tests/test_gtype.py	2018-09-29 00:34:59.732558746 +0530
40
+@@ -3,6 +3,8 @@ from __future__ import absolute_import
44 41
  import unittest
45 42
  
46 43
  from gi.repository import GObject
... ...
@@ -51,11 +31,9 @@ index 8099101..0d7f33f 100644
51 51
  from gi.repository import GIMarshallingTests
52 52
  
53 53
  
54
-diff --git a/tests/test_iochannel.py b/tests/test_iochannel.py.1
55
-index 5980a66..99333f6 100644
56
-+++ b/tests/test_iochannel.py.1
57
-@@ -51,6 +51,7 @@ second line
54
+--- a/tests/test_iochannel.py	2018-09-29 00:35:44.260560675 +0530
55
+@@ -55,6 +55,7 @@ second line
58 56
          self.assertEqual(ch.readline(), '')
59 57
          ch.shutdown(True)
60 58
  
... ...
@@ -63,12 +41,11 @@ index 5980a66..99333f6 100644
63 63
      def test_file_readline_latin1(self):
64 64
          ch = GLib.IOChannel(filename=self.testlatin1, mode='r')
65 65
          ch.set_encoding('latin1')
66
-@@ -113,6 +114,7 @@ second line
67
-         # invalid whence value
66
+@@ -118,6 +119,7 @@ second line
68 67
          self.assertRaises(ValueError, ch.seek, 0, 3)
68
+         ch.shutdown(True)
69 69
  
70 70
 +    @unittest.skip("disabled photon build")
71 71
      def test_file_write(self):
72 72
          ch = GLib.IOChannel(filename=self.testout, mode='w')
73 73
          ch.set_encoding('latin1')
74
-
... ...
@@ -2,24 +2,25 @@
2 2
 %{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
3 3
 
4 4
 Name:           pygobject
5
-Version:        3.24.1
6
-Release:        3%{?dist}
5
+Version:        3.30.1
6
+Release:        1%{?dist}
7 7
 Summary:        Python Bindings for GObject
8 8
 Group:          Development/Languages
9 9
 License:        LGPLv2+
10 10
 Vendor:         VMware, Inc.
11 11
 Distribution:   Photon
12
-URL:            ftp://ftp.gnome.org
13
-Source0:        ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.24/pygobject-3.24.1.tar.xz
12
+URL:            https://pypi.org/project/PyGObject
13
+Source0:        https://pypi.org/project/PyGObject/#files/PyGObject-%{version}.tar.gz
14 14
 Patch0:         pygobject-makecheck-fixes.patch
15
-%define sha1    pygobject=acdb1958e7f9785d92888a423afffd7164502f87
15
+Patch1:         build_without_cairo.patch
16
+%define sha1    PyGObject=d5a369f15dfd415dba7fad4c0f9811b56c597e10
16 17
 Requires:       python2
17 18
 Requires:       gobject-introspection
18 19
 Requires:       glib
20
+BuildRequires:  glib-devel
19 21
 BuildRequires:  python2-devel
20 22
 BuildRequires:  python2-libs
21 23
 BuildRequires:  gobject-introspection-devel
22
-BuildRequires:  glib-devel
23 24
 BuildRequires:  which
24 25
 %if %{with_check}
25 26
 BuildRequires:  gobject-introspection-python
... ...
@@ -54,38 +55,29 @@ Requires:       python3-pygobject = %{version}-%{release}
54 54
 Development files for pygobject.
55 55
 
56 56
 %prep
57
-%setup -q -n pygobject-%{version}
57
+%setup -q -n PyGObject-%{version}
58 58
 %patch0 -p1
59
+%patch1 -p1
59 60
 rm -rf ../p3dir
60 61
 cp -a . ../p3dir
61 62
 
62 63
 %build
63
-./configure \
64
-    --prefix=%{_prefix} \
65
-    --disable-cairo     \
66
-    --without-cairo     \
67
-    --with-python=/usr/bin/python2
68
-make
64
+python2 setup.py build
69 65
 pushd ../p3dir
70
-./configure \
71
-    --prefix=%{_prefix} \
72
-    --bindir=%{_bindir} \
73
-    --disable-cairo     \
74
-    --without-cairo     \
75
-    --with-python=/usr/bin/python3
76
-make
66
+python3 setup.py build
77 67
 popd
78 68
 
69
+
79 70
 %install
80
-make install DESTDIR=%{buildroot}
81 71
 pushd ../p3dir
82
-make install DESTDIR=%{buildroot}
72
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
83 73
 popd
74
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
84 75
 
85 76
 %check
86
-make %{?_smp_mflags} check
77
+python2 setup.py test
87 78
 pushd ../p3dir
88
-make %{?_smp_mflags} check
79
+python3 setup.py test
89 80
 popd
90 81
 
91 82
 %clean
... ...
@@ -104,6 +96,8 @@ rm -rf %{buildroot}
104 104
 %{_includedir}/*
105 105
 
106 106
 %changelog
107
+*   Thu Sep 27 2018 Tapas Kundu <tkundu@vmware.com> 3.30.1-1
108
+-   Updated to release 3.30.1
107 109
 *   Tue Sep 19 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 3.24.1-3
108 110
 -   Skip some ui make check paths that failed.
109 111
 *   Thu Aug 10 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 3.24.1-2