forked from adjacentlink/pynodestatviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpynodestatviz.spec.in
155 lines (133 loc) · 3.69 KB
/
pynodestatviz.spec.in
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
Summary: Simple Node Link and Statistic Visualization Tool
Name: pynodestatviz
Version: @VERSION@
Release: 1%{?dist}
License: BSD
Group: Development/Libraries
URL: https://github.com/adjacentlink/pynodestatviz
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Vendor: Adjacent Link LLC
BuildArch: noarch
%define with_old_depends 0
%define with_pathfix 1
# RHEL/CentOS
%if 0%{?el7}
%define with_python2 1
%define with_old_depends 1
%define with_pathfix 0
%endif
%if 0%{?el8}
%define with_python3 1
%endif
# Fedora (non-EOL)
%if 0%{?fedora}
%if %{fedora} < 31
%define with_python3 1
%define with_python2 1
%else
%define with_python3 1
%endif
%endif
%if 0%{?with_python2}
%if %{with_old_depends}
%define use_python2_sitelib %{python_sitelib}
%else
%define use_python2_sitelib %{python2_sitelib}
%endif
%endif
%global _description \
Simple Node Link and Statistic Visualization Tool
%description %{_description}
%if 0%{?with_python2}
%package -n python2-%{name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{name}}
%if %{with_old_depends}
BuildRequires: python-devel
Requires: tkinter
Requires: python-pmw
Requires: python-lxml
%define use_python2_sitelib %{python_sitelib}
%else
BuildRequires: python2-devel
Requires: python2-tkinter
Requires: python2-pmw
Requires: python2-lxml
%define use_python2_sitelib %{python2_sitelib}
%endif
%description -n python2-%{name} %{_description}
%endif
%if 0%{?with_python3}
%package -n python3-%{name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-devel
Requires: python3-tkinter
Requires: python3-pmw
Requires: python3-lxml
%description -n python3-%{name} %{_description}
%endif
%prep
%setup -q
%build
%configure
%install
%if 0%{?with_python3}
make DESTDIR=${RPM_BUILD_ROOT} PYTHON=%{__python3} install
mv %{buildroot}/%{_bindir}/pynodestatviz %{buildroot}/%{_bindir}/pynodestatviz-%{python3_version}
ln -s pynodestatviz-%{python3_version} %{buildroot}%{_bindir}/pynodestatviz-3
%if 0%{?with_python2} == 0
ln -s pynodestatviz-3 %{buildroot}%{_bindir}/pynodestatviz
%endif
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{_bindir}/*-%{python3_version}
%endif
%if 0%{?with_python2}
make DESTDIR=${RPM_BUILD_ROOT} PYTHON=%{__python2} install
mv %{buildroot}/%{_bindir}/pynodestatviz %{buildroot}/%{_bindir}/pynodestatviz-%{python2_version}
ln -s pynodestatviz-%{python2_version} %{buildroot}%{_bindir}/pynodestatviz-2
ln -s pynodestatviz-2 %{buildroot}%{_bindir}/pynodestatviz
%if %{with_pathfix}
pathfix.py -pni "%{__python2} %{py2_shbang_opts}" %{buildroot}%{_bindir}/*-%{python2_version}
%endif
%endif
find ${RPM_BUILD_ROOT} -name '*.a' -exec rm '{}' \;
find ${RPM_BUILD_ROOT} -name '*.la' -exec rm '{}' \;
mkdir -p ${RPM_BUILD_ROOT}%{_pkgdocdir}
install -t ${RPM_BUILD_ROOT}%{_pkgdocdir} AUTHORS %{!?_licensedir:COPYING} ChangeLog NEWS README
%if 0%{?_licensedir:1}
mkdir -p ${RPM_BUILD_ROOT}%{_licensedir}/%{name}
install -t ${RPM_BUILD_ROOT}%{_licensedir}/%{name} COPYING
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%post
%postun
%if 0%{?with_python2}
%files -n python2-%{name}
%defattr(-,root,root,-)
%{_bindir}/pynodestatviz
%{_bindir}/pynodestatviz-2
%{_bindir}/pynodestatviz-%{python2_version}
%{use_python2_sitelib}/*
%doc %{_pkgdocdir}
%if 0%{?_licensedir:1}
%dir %{_licensedir}/%{name}
%license %{_licensedir}/%{name}/COPYING
%endif
%endif
%if 0%{?with_python3}
%files -n python3-%{name}
%defattr(-,root,root,-)
%{_bindir}/pynodestatviz-3
%{_bindir}/pynodestatviz-%{python3_version}
%if 0%{?with_python2} == 0
%{_bindir}/pynodestatviz
%endif
%{python3_sitelib}/*
%doc %{_pkgdocdir}
%if 0%{?_licensedir:1}
%dir %{_licensedir}/%{name}
%license %{_licensedir}/%{name}/COPYING
%endif
%endif