Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tkdchen/5607189 to your computer and use it in GitHub Desktop.
Save tkdchen/5607189 to your computer and use it in GitHub Desktop.
Make changes according to your requirements. I use $var to indicate what you have to replace with real value. The template follows the RPM package naming convention in Fedora community. That is all Python package's name should have prefix ``python-`` .
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%global pkg_name $name
Name: python-%{pkg_name}
Version: $version
Release: 1%{?dist}
Summary: $summary
Group: Development/Languages
License: $license
URL: $url
Source0: %{pkg_name}-%{version}.tar.gz
BuildArch: noarch
# BuildRequires section here if necessary
# Requires section here if necessary
%description
%prep
%setup -q -n %{pkg_name}-%{version}
%build
%{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc CHANGES.txt LICENSE.txt MANIFEST.in README.rst TODO.txt VERSION.txt
%{python_sitelib}/%{pkg_name}/
%{python_sitelib}/%{pkg_name}-%{version}-py*.egg-info/
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment