Debian Codegraph @

misc/DisplayCAL.spec

raw
1 #
2 # spec file for package DisplayCAL
3 #
4 # Copyright (c) ${YEAR} SUSE LINUX GmbH, Nuernberg, Germany.
5 # Copyright (c) ${YEAR} Florian Hoech
6 #
7 # All modifications and additions to the file contributed by third parties
8 # remain the property of their copyright owners, unless otherwise agreed
9 # upon. The license for this file, and modifications and additions to the
10 # file, is the same license as for the pristine package itself (unless the
11 # license for the pristine package is not an Open Source License, in which
12 # case the license is the MIT License). An "Open Source License" is a
13 # license that conforms to the Open Source Definition (Version 1.9)
14 # published by the Open Source Initiative.
15
16 # Please submit bugfixes or comments via http://bugs.opensuse.org/
17 #
18
19
20 %define numpy_version 1.0
21 %define py_minversion ${PY_MINVERSION}
22 %define py_maxversion ${PY_MAXVERSION}
23 %define wx_minversion ${WX_MINVERSION}
24
25 %if 0%{?mandriva_version} > 0
26 %define correct_group Graphics
27 %else
28 %if 0%{?suse_version} > 0
29 %define correct_group Productivity/Graphics/Other
30 %else
31 %if 0%{?fedora_version} > 0 || 0%{?rhel_version} > 0 || 0%{?centos_version} > 0 || 0%{?scientificlinux_version} > 0
32 %define correct_group Applications/Multimedia
33 %endif
34 %endif
35 %endif
36
37 %define __python /usr/bin/python2
38
39 %global debug_package %{nil}
40
41 Summary: ${SUMMARY}
42 License: GPL-3.0+
43 Group: %{correct_group}
44 Name: ${PACKAGE}
45 Version: ${VERSION}
46 Release: 0
47 Source0: ${HTTPURL}download/%{name}-%version.tar.gz
48 Url: ${URL}
49 BuildRoot: %{_tmppath}/%{name}-%{version}-build
50 Obsoletes: DisplayCAL-0install
51 Provides: dispcalGUI = %{version}
52 Obsoletes: dispcalGUI < 3.1.0.0
53 Obsoletes: dispcalGUI-0install < 3.1.0.0
54 %if 0%{?mandriva_version} > 0
55 BuildRequires: gcc
56 BuildRequires: libpython-devel
57 BuildRequires: udev
58 %ifarch x86_64
59 BuildRequires: lib64xorg-x11-devel
60 %else
61 BuildRequires: libxorg-x11-devel
62 %endif
63 Requires: argyllcms
64 Requires: libsdl2_mixer2.0_0
65 Requires: python-numpy >= %{numpy_version}
66 Requires: wxPythonGTK >= %{wx_minversion}
67 Requires: python-psutil
68 Requires: python-dbus
69 %else
70 %if 0%{?suse_version} > 0
71 BuildRequires: gcc
72 BuildRequires: python-devel
73 BuildRequires: udev
74 BuildRequires: update-desktop-files
75 BuildRequires: pkgconfig(x11)
76 BuildRequires: pkgconfig(xinerama)
77 BuildRequires: pkgconfig(xrandr)
78 BuildRequires: pkgconfig(xxf86vm)
79 BuildRequires: python-xml
80 Requires: argyllcms
81 Requires: python-numpy >= %{numpy_version}
82 Requires: libSDL2_mixer-2_0-0
83 Requires: python-wxWidgets >= %{wx_minversion}
84 Requires: python-psutil
85 Requires: python-gobject
86 Requires: python-xml
87 %py_requires
88 %else
89 %if 0%{?rhel_version} > 0 || 0%{?centos_version} > 0 || 0%{?scientificlinux_version} > 0
90 BuildRequires: gcc
91 BuildRequires: libX11-devel
92 BuildRequires: libXinerama-devel
93 BuildRequires: libXrandr-devel
94 BuildRequires: libXxf86vm-devel
95 BuildRequires: python-devel
96 BuildRequires: udev
97 Requires: argyllcms
98 Requires: numpy >= %{numpy_version}
99 Requires: SDL2_mixer
100 Requires: wxPython >= %{wx_minversion}
101 Requires: python2-psutil
102 Requires: dbus-python
103 %else
104 %if 0%{?fedora_version} > 0
105 BuildRequires: gcc
106 BuildRequires: libX11-devel
107 BuildRequires: libXinerama-devel
108 BuildRequires: libXrandr-devel
109 BuildRequires: libXxf86vm-devel
110 BuildRequires: python2-devel
111 BuildRequires: udev
112 Requires: argyllcms
113 Requires: numpy >= %{numpy_version}
114 Requires: SDL2_mixer
115 Requires: wxPython >= %{wx_minversion}
116 Requires: python2-psutil
117 Requires: python2-gobject
118 %else
119 # Mageia
120 %define mageia_version 6
121 BuildRequires: gcc
122 BuildRequires: libx11-devel
123 BuildRequires: libxinerama-devel
124 BuildRequires: libxrandr-devel
125 BuildRequires: libxxf86vm-devel
126 BuildRequires: libpython-devel
127 BuildRequires: udev
128 Requires: argyllcms
129 Requires: libsdl2_mixer2.0_0
130 Requires: python-numpy >= %{numpy_version}
131 Requires: wxPython >= %{wx_minversion}
132 Requires: python-psutil
133 Requires: python-gi
134 %endif
135 %endif
136 %endif
137 %endif
138
139 %description
140 ${DESC}
141
142 %prep
143 %setup
144 # Convert line endings in LICENSE.txt
145 %{__python} -c "f = open('LICENSE.txt', 'rb')
146 d = f.read().replace('\r\n', '\n').replace('\r', '\n')
147 f.close()
148 f = open('LICENSE.txt', 'wb')
149 f.write(d)
150 f.close()"
151
152 %build
153 %{__python} setup.py build --use-distutils
154
155 %install
156 install_lib=`%{__python} -c "from distutils.sysconfig import get_python_lib;print get_python_lib(True)"`
157 %{__python} setup.py install --no-compile --use-distutils \
158 --root=$RPM_BUILD_ROOT \
159 --prefix=%_prefix \
160 --exec-prefix=%_exec_prefix \
161 --install-data=%_datadir \
162 --install-lib=${install_lib} \
163 --skip-instrument-configuration-files \
164 --skip-postinstall \
165 --record=INSTALLED_FILES
166 # Strip extensions
167 bits=`%{__python} -c "import platform;print platform.architecture()[0][:2]"`
168 python_shortversion=`%{__python} -c "import sys;print ''.join(map(str, sys.version_info[:2]))"`
169 strip --strip-unneeded ${RPM_BUILD_ROOT}${install_lib}/%{name}/lib${bits}/python${python_shortversion}/*.so
170 # Byte-compile *.py files and remove traces of RPM_BUILD_ROOT
171 %if 0%{?mandriva_version} < 201010
172 # Mandriva 2010.1 got rid of byte-compilation
173 %{__python} -c "import glob
174 import os
175 import platform
176 import sys
177 from distutils.sysconfig import get_python_lib
178 from distutils.util import byte_compile, change_root
179 bits = platform.architecture()[0][:2]
180 mod = os.path.join(change_root('$RPM_BUILD_ROOT', get_python_lib(True)), '%{name}')
181 for py in (glob.glob(os.path.join(mod, '*.py')),
182 glob.glob(os.path.join(mod, 'lib', '*.py')),
183 glob.glob(os.path.join(mod, 'lib', 'agw', '*.py')),
184 glob.glob(os.path.join(mod, 'lib' + bits, '*.py')),
185 glob.glob(os.path.join(mod, 'lib' + bits, 'python%s%s' % sys.version_info[:2], '*.py'))):
186 byte_compile(py, optimize=0, force=1, prefix='$RPM_BUILD_ROOT')
187 if (int('0%{?fedora_version}') > 0 or int('0%{?rhel_version}') > 0 or
188 int('0%{?centos_version}') > 0 or int('0%{?scientificlinux_version}') > 0):
189 byte_compile(py, optimize=1, force=1, prefix='$RPM_BUILD_ROOT')"
190 %endif
191 # Remove doc directory
192 if [ -e "${RPM_BUILD_ROOT}%_datadir/doc/%{name}-%{version}" ]; then
193 rm -rf "${RPM_BUILD_ROOT}%_datadir/doc/%{name}-%{version}"
194 fi
195 %if 0%{?suse_version} > 0
196 # Update desktop files to prevent buildservice from complaining
197 desktopfilenames=`%{__python} -c "import glob
198 import os
199 print ' '.join([os.path.splitext(os.path.basename(path))[0] for path in
200 glob.glob('misc/${APPNAME_LOWER}*.desktop')])"`
201 for desktopfilename in $desktopfilenames ; do
202 %suse_update_desktop_file $desktopfilename 2DGraphics
203 done
204 %suse_update_desktop_file "%{buildroot}/etc/xdg/autostart/z-${APPNAME_LOWER}-apply-profiles.desktop"
205 %endif
206 # Remove unused files from list of installed files and add directories
207 # as well as mark files as executable where needed
208 %{__python} -c "import os
209 f = open('INSTALLED_FILES')
210 paths = [chr(0x22) + path.replace('$RPM_BUILD_ROOT', '').strip() + chr(0x22) for path in
211 filter(lambda path: not '/doc/' in path and not '/etc/' in path and
212 not '/man/' in path,
213 f.readlines())]
214 f.close()
215 executables = ['Argyll'] + os.listdir('scripts')
216 for path in list(paths):
217 path = path.strip(chr(0x22))
218 if path.endswith('.py') and %{?mandriva_version}.0 < 201010:
219 # Mandriva 2010.1 got rid of byte-compilation
220 paths.append(chr(0x22) + path + 'c' + chr(0x22))
221 if (int('0%{?fedora_version}') > 0 or int('0%{?rhel_version}') > 0 or
222 int('0%{?centos_version}') > 0 or int('0%{?scientificlinux_version}') > 0 or
223 int('0%{?mageia_version}') > 0):
224 paths.append(chr(0x22) + path + 'o' + chr(0x22))
225 if os.path.basename(path) in executables:
226 paths.remove(chr(0x22) + path + chr(0x22))
227 paths.append('%attr(755, root, root) ' + chr(0x22) + path + chr(0x22))
228 while True:
229 path = os.path.dirname(path)
230 if os.path.isdir(path):
231 break
232 else:
233 directory = '%dir ' + chr(0x22) + path + chr(0x22)
234 if not directory in paths:
235 paths.append(directory)
236 f = open('INSTALLED_FILES', 'w')
237 f.write('\n'.join(paths))
238 f.close()"
239
240 %files -f INSTALLED_FILES
241 %defattr(-,root,root)
242 %config /etc/xdg/autostart/z-${APPNAME_LOWER}-apply-profiles.desktop
243 %doc LICENSE.txt
244 %doc README.html
245 %doc README-fr.html
246 %doc screenshots
247 %doc theme
248 /usr/share/man/man1/*
249
250 %post
251 ${POST}
252
253 %postun
254 ${POSTUN}
255
256 %changelog