[packages/pyp2rpm] add pld spec template

glen glen at pld-linux.org
Sun Mar 17 04:03:55 CET 2013


commit 41a9b90bdc471e391602a9692cebf9399e6855c0
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Mar 17 04:44:32 2013 +0200

    add pld spec template

 pld.spec.tmpl | 68 ++++++++++++++++++++++++++++++++---------------------------
 pyp2rpm.spec  | 12 ++++++++++-
 2 files changed, 48 insertions(+), 32 deletions(-)
---
diff --git a/pyp2rpm.spec b/pyp2rpm.spec
index 45e2f6f..358fccc 100644
--- a/pyp2rpm.spec
+++ b/pyp2rpm.spec
@@ -15,6 +15,7 @@ Source0:	http://pypi.python.org/packages/source/p/pyp2rpm/%{name}-%{version}.tar
 # git checkout v1.0.1 && tar czf pyp2rpm-1.0.1-tests.tgz tests/
 Source1:	%{name}-%{version}-tests.tgz
 # Source1-md5:	d6ffe3cd0acb10af01c99a77e6bd51f3
+Source2:	pld.spec.tmpl
 Patch0:		default-savepath.patch
 Patch1:		no-rpmdev-packager.patch
 URL:		https://pypi.python.org/pypi/pyp2rpm
@@ -43,6 +44,8 @@ information though).
 # Remove bundled egg-info
 rm -r %{name}.egg-info
 
+cp -p %{SOURCE2} pyp2rpm/templates/pld.spec
+
 %build
 %{__python} setup.py build
 
@@ -66,5 +69,12 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc README.rst LICENSE
 %attr(755,root,root) %{_bindir}/pyp2rpm
-%{py_sitescriptdir}/%{name}
+%dir %{py_sitescriptdir}/%{name}
+%{py_sitescriptdir}/%{name}/*.py[co]
+%dir %{py_sitescriptdir}/%{name}/templates
+%{py_sitescriptdir}/%{name}/templates/macros.spec
+%{py_sitescriptdir}/%{name}/templates/fedora.spec
+%{py_sitescriptdir}/%{name}/templates/mageia.spec
+%{py_sitescriptdir}/%{name}/templates/pld.spec
 %{py_sitescriptdir}/%{name}-%{version}-py*.egg-info
+
diff --git a/pld.spec.tmpl b/pld.spec.tmpl
index 0ec31d2..6ee900f 100644
--- a/pld.spec.tmpl
+++ b/pld.spec.tmpl
@@ -1,35 +1,32 @@
 {{ data.credit_line }}
 {% from 'macros.spec' import dependencies, for_python_versions, underscored_or_pypi -%}
-%global pypi_name {{ data.name }}
 {%- for pv in data.python_versions %}
-%global with_python{{ pv }} 1
+%define		with_python{{ pv }} 1
 {%- endfor %}
-%define version {{ data.version }}
-
-Name:           {{ data.pkg_name|name_for_python_version(data.base_python_version) }}
-Version:        %{version}
-Release:        %mkrel 1
-Group:          Development/Python
-Summary:        {{ data.summary }}
-
-License:        {{ data.license }}
-URL:            {{ data.release_url|replace(data.version, '%{version}') }}
-Source0:        {{ data.url|replace(data.version, '%{version}') }}
-
-{%- if not data.has_extension %}
-BuildArch:      noarch
-{%- endif %}
+%define		pypi_name	{{ data.name }}
+Summary:	{{ data.summary }}
+Name:		{{ data.pkg_name|macroed_pkg_name|name_for_python_version(data.base_python_version) }}
+Version:	{{ data.version }}
+Release:	0.1
+License:	{{ data.license }}
+Group:		Libraries/Python
+Source0:	{{ data.url|replace(data.version, '%{version}') }}
+# Source0-md5:	-
+URL:		{{ data.release_url|replace(data.version, '%{version}') }}
 {{ dependencies(data.build_deps, False, data.base_python_version, data.base_python_version) }}
 {%- for pv in data.python_versions %}
 {{ dependencies(data.build_deps, False, pv, data.base_python_version) }}
 {%- endfor %}
 {{ dependencies(data.runtime_deps, True, data.base_python_version, data.base_python_version) }}
+{%- if not data.has_extension %}
+BuildArch:	noarch
+{%- endif %}
 
 %description
 {{ data.description|truncate(400)|wordwrap }}
 {% call(pv) for_python_versions(data.python_versions) -%}
-%package -n     {{ data.name|macroed_pkg_name|name_for_python_version(pv) }}
-Summary:        {{ data.summary }}
+%package -n {{ data.name|macroed_pkg_name|name_for_python_version(pv) }}
+Summary:	{{ data.summary }}
 {{ dependencies(data.runtime_deps, True, pv, pv) }}
 
 %description -n {{ data.name|macroed_pkg_name|name_for_python_version(pv) }}
@@ -40,7 +37,7 @@ Summary:        {{ data.summary }}
 %setup -q -n %{pypi_name}-%{version}
 {%- if data.has_bundled_egg_info %}
 # Remove bundled egg-info
-rm -rf %{pypi_name}.egg-info
+%{__rm} -r %{pypi_name}.egg-info
 {%- endif %}
 {% call(pv) for_python_versions([data.base_python_version] + data.python_versions, data.base_python_version) -%}
 {%- if pv != data.base_python_version -%}
@@ -52,18 +49,21 @@ find %{py{{pv}}dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python{{pv}}
 # generate html docs {# TODO: generate properly for other versions (pushd/popd into their dirs...) #}
 {% if pv != data.base_python_version %}python{{ pv }}-{% endif %}sphinx-build {{ data.sphinx_dir }} html
 # remove the sphinx-build leftovers
-rm -rf html/.{doctrees,buildinfo}
+%{__rm} -r html/.{doctrees,buildinfo}
 {%- endif %}
 {% endcall %}
 
 %build
 {%- call(pv) for_python_versions([data.base_python_version] + data.python_versions, data.base_python_version) -%}
 {%- if pv != data.base_python_version -%}
-pushd %{py{{ pv }}dir}
+cd %{py{{ pv }}dir}
 {%- endif %}
-{% if data.has_extension %}CFLAGS="$RPM_OPT_FLAGS" {% endif %}{{ '%{__python}'|python_bin_for_python_version(pv) }} setup.py build
+{% if data.has_extension %}
+CC="%{__cc}" \
+CFLAGS="%{rpmcflags}" \
+{% endif %}{{ '%{__python}'|python_bin_for_python_version(pv) }} setup.py build
 {% if pv != data.base_python_version -%}
-popd
+cd -
 {%- endif %}
 {%- endcall %}
 
@@ -75,26 +75,32 @@ popd
 {%- endif -%}
 {%- call(pv) for_python_versions(data.python_versions + [data.base_python_version], data.base_python_version) -%}
 {%- if pv != data.base_python_version -%}
-pushd %{py{{ pv }}dir}
+cd %{py{{ pv }}dir}
 {%- endif %}
-{{ '%{__python}'|python_bin_for_python_version(pv) }} setup.py install --skip-build --root %{buildroot}
+{{ '%{__python}'|python_bin_for_python_version(pv) }} setup.py install \
+	--skip-build \
+	--optimize=2 \
+	--root=$RPM_BUILD_ROOT
 {%- if pv != data.base_python_version %}
 {%- if data.scripts %}
 {%- for script in data.scripts %}
-mv %{buildroot}%{_bindir}/{{ script }} %{buildroot}/%{_bindir}/{{ script|script_name_for_python_version(pv) }}
+mv $RPM_BUILD_ROOT%{_bindir}/{{ script }} $RPM_BUILD_ROOT%{_bindir}/{{ script|script_name_for_python_version(pv) }}
 {%- endfor %}
 {%- endif %}
-popd
+cd -
 {%- endif %}
 {%- endcall %}
 
+%clean
+rm -rf $RPM_BUILD_ROOT
 
 {% call(pv) for_python_versions([data.base_python_version] + data.python_versions, data.base_python_version) -%}
 %files{% if pv != data.base_python_version %} -n {{ data.pkg_name|macroed_pkg_name|name_for_python_version(pv) }}{% endif %}
+%defattr(644,root,root,755)
 %doc {% if data.sphinx_dir %}html {% endif %}{{ data.doc_files|join(' ') }}
 {%- if data.scripts %}
 {%- for script in data.scripts %}
-%{_bindir}/{{ script|script_name_for_python_version(pv) }}
+%attr(755,root,root) %{_bindir}/{{ script|script_name_for_python_version(pv) }}
 {%- endfor %}
 {%- endif %}
 {%- if data.has_packages %}
@@ -105,10 +111,10 @@ popd
 {%- if pv == '3' -%}
 {{ '%{python_sitelib}'|sitedir_for_python_version(pv) }}/__pycache__/*
 {% endif -%}
-{{ '%{python_sitelib}'|sitedir_for_python_version(pv) }}/{% if data.name == module %}%{pypi_name}{% else %}{{ module }}{% endif %}.py{% if pv != '3'%}*{% endif %}
+{{ '%{python_sitelib}'|sitedir_for_python_version(pv) }}/{% if data.name == module %}%{pypi_name}{% else %}{{ module }}{% endif %}.py{% if pv != '3'%}[co]{% endif %}
 {%- endfor %}
 {%- endif %}
-{{ '%{python_sitelib}'|sitedir_for_python_version(pv) }}/{{ underscored_or_pypi(data.name, data.underscored_name) }}-%{version}-py?.?.egg-info
+{{ '%{python_sitelib}'|sitedir_for_python_version(pv) }}/{{ underscored_or_pypi(data.name, data.underscored_name) }}-%{version}-py*.egg-info
 {%- if data.has_extension %}
 {{ '%{python_sitearch}'|sitedir_for_python_version(pv) }}/{{ underscored_or_pypi(data.name, data.underscored_name) }}
 {%- endif %}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pyp2rpm.git/commitdiff/41a9b90bdc471e391602a9692cebf9399e6855c0



More information about the pld-cvs-commit mailing list