forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-with-pip.file
68 lines (52 loc) · 1.36 KB
/
build-with-pip.file
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
#File: with-with-pip
%if "%{?pip_name:set}" != "set"
%define pip_name %(echo %n | cut -f2-5 -d-)
%endif
%if "%{?PipDownloadOptions:set}" != "set"
%define PipDownloadOptions --no-deps%%20--no-binary%%3D:all:
%endif
%if "%{?PipBuildOptions:set}" != "set"
%define PipBuildOptions --no-deps
%endif
%if "%{?source0:set}" != "set"
%define source0 pip://%{pip_name}/%{realversion}?pip_options=%{PipDownloadOptions}&output=/source.tar.gz
%endif
%if "%{?doPython2:set}" != "set"
%define doPython2 yes
%endif
%if "%{?doPython3:set}" != "set"
%define doPython3 yes
%endif
Source: %source0
Requires: python
Requires: python3
BuildRequires: py2-pip
%prep
%build
mkdir -p %{i}
%if "%{?source_file:set}" != "set"
tar xfz %{_sourcedir}/source.tar.gz
%else
cp %{_sourcedir}/source.tar.gz %{source_file}
echo %{source_file} > files.list
%endif
%{?PipPreBuild:%PipPreBuild}
if [ `cat files.list | wc -l` == "1" ] ; then
export PIPFILE=`cat files.list`
echo ${PIPFILE}
export PYTHONUSERBASE=%i
%if "%{doPython3}" == "yes"
pip3 list
pip3 install --user -v %{PipBuildOptions} $PIPFILE
%endif
%if "%{doPython2}" == "yes"
pip2 list
pip2 install --user -v %{PipBuildOptions} $PIPFILE
%endif
else
echo "Sorry I don't know how to handle no/multiple install files yet"
cat %{_sourcedir}/files.txt
exit 1
fi
%install
%{?PipPostBuild:%PipPostBuild}