]> git.pld-linux.org Git - projects/template-specs.git/blobdiff - python.spec
setuptools is likely to be used
[projects/template-specs.git] / python.spec
index 32fea52122c2be2cb5dd7e3e9d215918417de45b..f40beda00f4b0ba113f41c10923a6039112d76f9 100644 (file)
@@ -9,6 +9,7 @@
 %bcond_without python2 # CPython 2.x module
 %bcond_without python3 # CPython 3.x module
 
+# NOTE: 'module' should match the python import path, not the egg name
 %define        module  template
 Summary:       -
 Summary(pl.UTF-8):     -
@@ -27,11 +28,11 @@ BuildRequires:      rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.714
 %if %{with python2}
 BuildRequires: python-modules
-#BuildRequires:        python-setuptools
+BuildRequires: python-setuptools
 %endif
 %if %{with python3}
 BuildRequires: python3-modules
-#BuildRequires:        python3-setuptools
+BuildRequires: python3-setuptools
 %endif
 # when using /usr/bin/env or other in-place substitutions
 #BuildRequires:        sed >= 4.0
@@ -92,6 +93,12 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %py_install
 
+# when files are installed in other way that standard 'setup.py
+# they need to be (re-)compiled
+# change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+
 %py_postclean
 %endif
 
@@ -101,8 +108,10 @@ rm -rf $RPM_BUILD_ROOT
 
 # in case there are examples provided
 %if %{with python2}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \
+       | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
 %endif
 %if %{with python3}
 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
@@ -119,10 +128,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
 %{py_sitescriptdir}/%{module}
-%if "%{py_ver}" > "2.4"
 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
-%endif
-%{_examplesdir}/%{name}-%{version}
+%{_examplesdir}/python-%{module}-%{version}
 %endif
 
 %if %{with python3}
This page took 0.029518 seconds and 4 git commands to generate.