File python-hgdistver.spec of Package python-hgdistver
#
# spec file for package python-hgdistver
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-hgdistver
Version: 0.17
Release: 0
Summary: Utility lib to generate python package version infos from mercurial tags
License: MIT
Group: Development/Languages/Python
Url: http://bitbucket.org/RonnyPfannschmidt/hgdistver/
Source: http://pypi.python.org/packages/source/h/hgdistver/hgdistver-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
This module is a simple drop-in to support setup.py
in mercurial based projects.
Alternatively it can be a setup time requirement.
Its supposed to generate version numbers from mercurials meta-data.
It tries to use the current tag and
falls back to the next reachable tagged ancestor and
using the distance to it as .post marker.
It uses 4 strategies to archive its task:
1. try to directly ask hg for the tag/distance
2. try to infer it from the `.hg_archival.txt` file
3. try to use the cache file if it exists
4. try to read the version from the 'PKG-INFO' file sdists contain (this is a nasty abuse)
The most simple usage is::
from setuptools import setup
from hgdistver import get_version
setup(
...,
version=get_version(),
...,
)
`get_version` takes the optional argument `cachefile`,
which causes it to store the version info in a python script instead
of abusing PKG-INFO from a sdist.
The setup requirement usage is::
from setuptools import setup
setup(
...,
get_version_from_hg=True,
setup_requires=['hgdistver'],
...,
)
The requirement uses the setup argument cache_hg_version_to instead of cachefile.
%prep
%setup -q -n hgdistver-%{version}
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%files
%defattr(-,root,root,-)
%doc README.txt
%{python_sitelib}/*
%changelog