forked from containerbuildsystem/dockerfile-parse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpython-dockerfile-parse.spec
154 lines (121 loc) · 3.83 KB
/
python-dockerfile-parse.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
%if 0%{?rhel} && 0%{?rhel} <= 7
%{!?py2_build: %global py2_build %{__python2} setup.py build}
%{!?py2_install: %global py2_install %{__python2} setup.py install --skip-build --root %{buildroot}}
%global py2name python
%bcond_with python3
%if 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python2_version: %global python2_version %(%{__python2} -c "import sys; sys.stdout.write(sys.version[:3])")}
%endif
%else
%bcond_without python3
%global py2name python2
%endif
%bcond_without tests
%global srcname dockerfile-parse
%global modname %(n=%{srcname}; echo ${n//-/_})
%global commit 2a3f224d86afb247c54e5227c2a23ffeb83a693c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: python-%{srcname}
Version: 0.0.10
Release: 1%{?dist}
Summary: Python library for Dockerfile manipulation
License: BSD
URL: https://github.com/DBuildService/dockerfile-parse
Source0: %{url}/archive/%{commit}/%{srcname}-%{commit}.tar.gz
BuildArch: noarch
%description
%{summary}.
%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
BuildRequires: %{py2name}-devel
BuildRequires: %{py2name}-setuptools, %{py2name}-six
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: pytest
%else
BuildRequires: python2-pytest
%endif
%description -n python2-%{srcname}
%{summary}.
Python 2 version.
%if %{with python3}
%package -n python3-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if %{with tests}
BuildRequires: python3-six, python3-pytest
%endif
%description -n python3-%{srcname}
%{summary}.
Python 3 version.
%endif
%prep
%setup -n %{srcname}-%{commit}
%build
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%py2_install
%if %{with python3}
%py3_install
%endif
%if %{with tests}
%check
export LANG=C.utf8
py.test-%{python2_version} -v tests
%if %{with python3}
py.test-%{python3_version} -v tests
%endif
%endif
%files -n %{py2name}-%{srcname}
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{modname}-*.egg-info/
%{python2_sitelib}/%{modname}/
%if %{with python3}
%files -n python3-%{srcname}
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{modname}-*.egg-info/
%{python3_sitelib}/%{modname}/
%endif
%changelog
- new upstream release: 0.0.10
- new upstream release: 0.0.9
- new upstream release: 0.0.8
- 0.0.7
* Fri Feb 3 2017 Tim Waugh <[email protected]>
- Incorporate modernisations from Fedora spec file.
- 0.0.6
- don't use py3dir
- new python macros
- use python_provide macro
- %%check section
- 0.0.5
- 0.0.4
- define macros for RHEL-6
- 0.0.3
- 0.0.2
- initial release