Rpm-packaging/ContentStyle

=Code style definition= Code should be written in common manner and in the way easy to read.

Head

 * All %global variables must be declared at the very beginning
 * Name: value, which is used within py2name context function, must equals pypi name!
 * Version: value is almost equals to git tag. For non trivial versions containing  dev, alpha, beta, rc in version should be used tilda=~ as delimiter from numerical version part.

Indentation

 * Horizontal indentation - the values goes right after the BuildRequires: and 2 spaces.
 * Vertical indentation - all logical blocks like %pre, %build, %install, %files, etc should be separated with 1 newline.

Example
%global sname py_name Name: Version:       X.Y.Z Release:        0 Summary:       A for .... functionality for OpenStack projects License: Group:         Development/Languages/Python Url:           http://www.homepage.org/ Source:        https://pypi.io/packages/source/o/%{sname}/%{sname}-%{version}.tar.gz BuildRequires:  openstack-macros BuildRequires: BuildRequires: BuildRequires: Requires: Requires: BuildArch:     noarch

%description A py_name ......... for OpenStack projects
 * Documentation: http://docs.openstack.org/developer/py_name
 * Source: http://git.openstack.org/cgit/openstack/py_name
 * Bugs: http://bugs.launchpad.net/py_name

%package doc Summary:       Documentation for the py_name Group:         Documentation BuildRequires: BuildRequires: Requires:      %{name} = ${version}

%description doc Documentation for py_name .........

%prep %setup -q -n %{sname}-%{version}

%build %{__python2} setup.py build %{__python2} setup.py build_sphinx rm -rf doc/build/html/.{doctrees,buildinfo}
 * 1) generate html docs
 * 1) remove the sphinx-build leftovers

%install %{__python2} setup.py install --prefix=%{_prefix} --root=%{buildroot}

%check export PATH="$PATH:%{buildroot}/%{_bindir}" export PYTHONPATH="%{python2_sitearch}:%{python2_sitelib}:%{buildroot}%{python2_sitelib}" %{__python2} setup.py testr

%files %defattr(-,root,root,-) %license LICENSE %doc README.rst ChangeLog %{_bindir}/py_name_cli %{python2_sitelib}/py_name %{python2_sitelib}/py_name*egg-info

%files doc %license LICENSE %doc doc/build/html

%changelog