b1e484
%global debug_package %{nil}
b1e484
%global _hardened_build 1
b1e484
b1e484
b1e484
Name:           micropython
4323ef
Version:        1.11
c2008f
Release:        2%{?dist}
b1e484
Summary:        Implementation of Python 3 with very low memory footprint
f9c193
f9c193
# micorpython itself is MIT
f9c193
# axtls and berkeley-db are BSD
f9c193
License:        MIT and BSD
f9c193
b1e484
URL:            http://micropython.org/
b1e484
Source0:        https://github.com/micropython/micropython/archive/v%{version}.tar.gz
b1e484
c1afad
%global axtls_commit 43a6e6bd3bbc03dc501e16b89fba0ef042ed3ea0
f9c193
Source1:       https://github.com/pfalcon/axtls/archive/%{axtls_commit}/axtls-%{axtls_commit}.tar.gz
f9c193
481e33
%global berkley_commit 35aaec4418ad78628a3b935885dd189d41ce779b
f9c193
Source2:       https://github.com/pfalcon/berkeley-db-1.xx/archive/%{berkley_commit}/berkeley-db-1.xx-%{berkley_commit}.tar.gz
f9c193
cdb89c
# Other arches need active porting
007ea5
ExclusiveArch:  %{arm} %{ix86} x86_64
cdb89c
da4686
BuildRequires:  gcc
b1e484
BuildRequires:  python3-devel
b1e484
BuildRequires:  libffi-devel
b1e484
BuildRequires:  readline-devel
b1e484
BuildRequires:  execstack
1dd399
BuildRequires:  openssl-devel
b1e484
c1afad
# Part of the tests runs MicroPython and CPython and compares the results.
c1afad
# MicroPython is ~3.4.
c1afad
# In Python 3.7 however, StopIteration handling in generators changed
c1afad
# and the results are no longer comparable.
c1afad
# PEP 479: https://www.python.org/dev/peps/pep-0479/
c1afad
# Upstream issue: https://github.com/micropython/micropython/issues/4000
c1afad
# We use the latest working CPython version in those test, setting the
c1afad
# MICROPY_CPYTHON3 environment variable.
c1afad
# Normal %%{__pytohn3} is used anywhere else.
c1afad
# There is no runtime dependency on this CPython (or any other).
e318ff
# This is fixed upstream now, but we keep the macros for future use
e318ff
%global cpython_version_tests 3.7
c1afad
BuildRequires:  %{_bindir}/python%{cpython_version_tests}
c1afad
f9c193
Provides:       bundled(axtls)
f9c193
Provides:       bundled(libdb) = 1.85
f9c193
b1e484
%description
b1e484
Implementation of Python 3 with very low memory footprint
b1e484
b1e484
%prep
e318ff
%autosetup -p1 -n %{name}-%{version}
b1e484
f9c193
# git submodules
f9c193
rmdir lib/axtls
f9c193
tar -xf %{SOURCE1}
f9c193
mv axtls-%{axtls_commit} lib/axtls
f9c193
f9c193
head -n 28 lib/axtls/axtlswrap/Makefile > LICENSE.axtls
f9c193
f9c193
rmdir lib/berkeley-db-1.xx
f9c193
tar -xf %{SOURCE2}
f9c193
mv berkeley-db-1.xx-%{berkley_commit} lib/berkeley-db-1.xx
f9c193
f9c193
head -n 32 lib/berkeley-db-1.xx/db/db.c > LICENSE.libdb
f9c193
02a71a
# Fix shebangs
02a71a
files=$(grep -rl '#!/usr/bin/env python')
02a71a
pathfix.py -i %{__python3} -p $files
02a71a
b1e484
# Removing pre-built binary; not required for build
481e33
rm ports/cc3200/bootmgr/relocator/relocator.bin
b1e484
246208
# https://github.com/micropython/micropython/issues/4457
246208
sed -i -e '/^int __GI_vsnprintf/d' lib/utils/printf.c
246208
246208
b1e484
%build
481e33
pushd ports/unix
f9c193
make axtls V=1 %{?_smp_mflags}
02a71a
make PYTHON=%{__python3} V=1 %{?_smp_mflags}
f9c193
popd
b1e484
481e33
execstack -c ports/unix/micropython
b1e484
b1e484
%check
481e33
pushd ports/unix
c1afad
export MICROPY_CPYTHON3=python%{cpython_version_tests}
02a71a
make PYTHON=%{__python3} V=1 test
b1e484
popd
b1e484
b1e484
%install
b1e484
mkdir -p %{buildroot}%{_bindir}
481e33
install -pm 755 ports/unix/micropython %{buildroot}%{_bindir}
b1e484
b1e484
%files
b1e484
%doc README.md
f9c193
%license LICENSE LICENSE.axtls LICENSE.libdb
b1e484
%{_bindir}/micropython
b1e484
b1e484
%changelog
c2008f
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-2
c2008f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
c2008f
4323ef
* Wed Jul 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.11-1
4323ef
- Update to 1.11 (#1714903)
4323ef
246208
* Sun Feb 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.10-1
246208
- Update to 1.10 (#1669547)
246208
aa07b0
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.4-3
aa07b0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
aa07b0
007ea5
* Sun Jan 13 2019 Miro Hrončok <mhroncok@redhat.com> - 1.9.4-2
007ea5
- Enable i686, fix a FTBFS (#1556924)
007ea5
c1afad
* Wed Aug 01 2018 Miro Hrončok <mhroncok@redhat.com> - 1.9.4-1
c1afad
- Update to 1.9.4 (#1577187)
c1afad
- Use CPython 3.6 in tests that compare results due to PEP479 (#1604827)
c1afad
ab2af3
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.3-6
ab2af3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ab2af3
59de59
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.9.3-5
59de59
- Rebuilt for Python 3.7
59de59
02a71a
* Thu Mar 15 2018 Miro Hrončok <mhroncok@redhat.com> - 1.9.3-4
02a71a
- Get rid of python2 build dependency
a37660
- Temporarily disable i686, investigate later
02a71a
f0be32
* Thu Mar 15 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.9.3-3
f0be32
- Update Python 2 dependency declarations to new packaging standards
f0be32
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
f0be32
0e1aff
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.3-2
0e1aff
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
0e1aff
481e33
* Wed Nov 01 2017 Miro Hrončok <mhroncok@redhat.com> - 1.9.3-1
481e33
- Update to 1.9.3 (#1508424)
481e33
f9c193
* Tue Sep 12 2017 Miro Hrončok <mhroncok@redhat.com> - 1.9.2-1
f9c193
- Update to 1.9.2 (#1332739) and fix FTBFS (#1423943)
f9c193
- Add 2 git submodules to sources, add bundled provides
f9c193
- Changed license tag to include BSD (becasue of those submodules)
f9c193
b76468
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1-5
b76468
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
b76468
3d4d5b
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1-4
3d4d5b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
3d4d5b
7ee386
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.1-3
7ee386
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7ee386
cdb89c
* Sat Aug 13 2016 Peter Robinson <pbrobinson@fedoraproject.org> 1.8.1-2
cdb89c
- Add ExclusiveArch, other arches need active porting
cdb89c
c70af0
* Wed Jun 06 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.8.1-1
c70af0
- Update to 1.8.1
c70af0
f2a614
* Wed May 04 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.8-1
c70af0
- Update to 1.8
f2a614
ad9928
* Tue Apr 19 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.7-1
c70af0
- Update to 1.7
ad9928
b1e484
* Tue Apr 05 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6-3
b1e484
- Remove license-encumbered bits in stmhal/
b1e484
b1e484
* Tue Apr 05 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6-2
b1e484
- Remove cc3200/bootmgr/relocator/relocator.bin
b1e484
- Fix license macro
b1e484
b1e484
* Tue Apr 05 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6-1
b1e484
- Update to 1.6
b1e484
b1e484
* Tue May 20 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.2-1
b1e484
- Initial spec