forked from Nuitka/Nuitka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuitka.spec
271 lines (232 loc) · 7.26 KB
/
nuitka.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
%if 0%{?rhel} < 8
# detect python site-packages path, use get_python_lib(0) as nuitka using
%if 0%{?fedora} < 31
%global python_sitearch %(%{__python} -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_python_lib(0))")
%endif
%global python3_sitearch %(%{__python3} -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_python_lib(0))")
%endif
%global _python_bytecompile_errors_terminate_build 0
Name: nuitka
Version: VERSION
Release: 5%{?dist}
Summary: Python compiler with full language support and CPython compatibility
Group: Development/Languages/Python
License: Apache-2.0
URL: https://nuitka.net/
Source0: https://nuitka.net/releases/Nuitka-%{version}.tar.gz
Source1: nuitka-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?fedora} < 28 && 0%{?rhel} < 8
BuildRequires: python
BuildRequires: python-devel
BuildRequires: python-setuptools
%endif
%if 0%{?fedora} < 31 && 0%{?rhel} < 8
BuildRequires: python-markupsafe
%endif
%if 0%{?fedora} >= 24
BuildRequires: python-libs
BuildRequires: python-debug
%endif
%if 0%{?fedora} >= 24 || 0%{?suse_version} >= 1500
BuildRequires: python3
BuildRequires: python3-devel
%endif
%if 0%{?rhel} == 8
BuildRequires: python36
BuildRequires: python36-devel
%endif
%if 0%{?fedora} >= 24 || 0%{?rhel} == 8
BuildRequires: python3-markupsafe
%endif
%if 0%{?suse_version} >= 1500
BuildRequires: python3-MarkupSafe
%if 0%{?sle_version} == 0
BuildRequires: openSUSE-release
%else
BuildRequires: dummy-release
%endif
%endif
%if 0%{?fedora} >= 27
BuildRequires: python3-tools
%endif
%if 0%{?fedora} >= 35 || 0%{?suse_version} >= 1500
BuildRequires: python3-setuptools
%endif
BuildRequires: gcc-c++
BuildRequires: strace
BuildRequires: patchelf
BuildRequires: ccache
BuildRequires: gdb
%if 0%{?fedora} < 28 && 0%{?rhel} < 8
Requires: python-devel
%endif
%if 0%{?fedora} >= 24 || 0%{?suse_version} >= 1500
Requires: python3-devel
%endif
%if 0%{?rhel} == 8
Requires: python36-devel
%endif
%if 0%{?fedora} < 31 && 0%{?rhel} < 8
Requires: python-markupsafe
%endif
%if 0%{?fedora} >= 24 || 0%{?rhel} == 8
Requires: python3-markupsafe
%endif
%if 0%{?suse_version} >= 1500
Requires: python3-MarkupSafe
%if 0%{?sle_version} == 0
Requires: openSUSE-release
%else
Requires: dummy-release
%endif
%endif
Requires: gcc-c++
Requires: strace
Requires: patchelf
Requires: ccache
BuildArchitectures: noarch
%description
Python compiler with full language support and CPython compatibility
This Python compiler achieves full language compatibility and compiles Python
code into compiled objects that are not second class at all. Instead they can
be used in the same way as pure Python objects.
%prep
%setup -q -n Nuitka-%{version}
%build
python2=`which python2 2>/dev/null || true`
if [ "$python2" != "" ]
then
python2_version=`$python2 -c "import sys; print '.'.join(str(s) for s in sys.version_info[0:2])"`
fi
python3=`which python3 2>/dev/null || true`
# Only used on Windows:
rm -rf nuitka/build/inline_copy/lib/scons-4*
if [ "$python2_version" != "2.6" ]
then
# Remove files needed only for Python 2.6, they only cause errors during
# compilation with Python3.
rm -rf nuitka/build/inline_copy/lib/scons-2.3.2
else
# Remove files mot needed for Python 2.6, they only cause errors during
# compilation with Python 2.6.
rm -rf nuitka/build/inline_copy/lib/scons-3.1.2
rm -rf nuitka/build/inline_copy/tqdm
fi
# These are all Windows only or used only there.
rm -rf nuitka/build/inline_copy/clcache
rm -rf nuitka/build/inline_copy/atomicwrites
rm -rf nuitka/build/inline_copy/colorama
if [ "$python2" != "" ]
then
python2_version=`$python2 -c "import sys; print '.'.join(str(s) for s in sys.version_info[0:2])"`
$python2 setup.py build
fi
if [ "$python3" != "" ]
then
$python3 setup.py build
fi
%check
echo "Environment variables during build:"
env
echo "OS information during build:"
if [ -f /etc/os-release ]
then
echo "Contents of /etc/os-release :"
cat /etc/os-release
else
echo "No /etc/os-release file found"
fi
if [ -f /etc/SuSE-release ]
then
echo "Contents of /etc/SuSE-release :"
cat /etc/SuSE-release
else
echo "No /etc/SuSE-release file found"
fi
if [ -f /etc/issue ]
then
echo "Contents of /etc/issue :"
cat /etc/issue
else
echo "No /etc/issue file found"
fi
if [ -x "$(command -v lsb_release)" ]
then
lsb_release -a
else
echo "No lsb_release binary found"
fi
python2=`which python2 || true`
if [ "$python2" != "" ]
then
echo "Nuitka Version information"
$python2 -m nuitka.__main__ --version
echo "Basic compilation test of empty module:"
$python2 -m nuitka.__main__ --module --show-scons --run --report=out.xml --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
echo "Basic compilation test of empty program:"
$python2 -m nuitka.__main__ --show-scons --run --report=compilation-report-exe.xml --experimental=debug-report-traceback tests/basics/EmptyModuleTest.py
$python2 ./tests/run-tests --skip-reflection-test
else
echo "Nuitka Version information"
python3 -m nuitka --version
echo "Basic compilation test of empty module:"
python3 -m nuitka --module --show-scons --run tests/basics/EmptyModuleTest.py
echo "Basic compilation test of empty program:"
python3 -m nuitka --show-scons --run tests/basics/EmptyModuleTest.py
python3 ./tests/run-tests --skip-reflection-test
fi
%install
rm -rf %{buildroot}
python2=`which python2 || true`
python3=`which python3 || true`
if [ "$python2" != "" ]
then
$python2 setup.py install --skip-build --prefix %{_prefix} --root=%{buildroot}
fi
if [ "$python3" != "" ]
then
$python3 setup.py install --skip-build --prefix %{_prefix} --root=%{buildroot}
fi
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.rst Changelog.rst
%if 0%{?fedora} < 31 && 0%{?rhel} < 8
%{_bindir}/nuitka2
%{_bindir}/nuitka2-run
%{python_sitearch}/*
%endif
%if 0%{?fedora} >= 24 || 0%{?suse_version} >= 1500
%{python3_sitearch}/*
%{_bindir}/nuitka3
%{_bindir}/nuitka3-run
%endif
%if 0%{?rhel} == 8
/usr/lib/python3.6/site-packages/
%{_bindir}/nuitka3
%{_bindir}/nuitka3-run
%endif
%changelog
* Sat Dec 28 2019 Kay Hayen <kay.hayen@gmail.com> - 0.6.7
- adapted for Fedora31 and CentOS 8, Python3 enhancements
- added Python3 for openSUSE 15 or higher too.
* Fri Jun 07 2019 Kay Hayen <kay.hayen@gmail.com> - 0.6.4
- adapted for Fedora30
* Mon Mar 26 2018 Kay Hayen <kay.hayen@gmail.com> - 0.5.29
- added Python3 packaging
* Sun Sep 08 2013 Kay Hayen <kay.hayen@gmail.com> - 0.4.6
- changed description to match what we use for Debian
* Fri Mar 15 2013 Kay Hayen <kay.hayen@gmail.com> - 0.4.2
- addressed complaints from opensuse buildservice
- moved to group "/Development/Languages/Python"
- no trailing dot for description,
- man pages also for Python3 related binaries
* Sun Mar 10 2013 ownssh <ownssh@gmail.com> - 0.4.1-3
- use shortcut files to support python3 (remove python3 base package)
- change requires python to python-devel
* Thu Mar 07 2013 ownssh <ownssh@gmail.com> - 0.4.1-2
- Add python3 support
* Thu Mar 07 2013 ownssh <ownssh@gmail.com> - 0.4.1-1
- Initial packaging of Nuitka as RPM.