File python-argparse.spec of Package python-argparse

#
# spec file for package python-argparse
#
# Copyright (c) 2011 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/
#

# norootforbuild

%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

%define mod_name argparse

Name:           python-%{mod_name}
Version:        1.1
Release:        2
Url:            http://code.google.com/p/argparse/
Summary:        Python command-line parsing library
License:        Apache 2.0
Group:          Development/Languages/Python
Source:         %{mod_name}-%{version}.tar.bz2
Source1:        %{mod_name}-%{version}.pdf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  dos2unix python-devel
%if 0%{?suse_version}
%py_requires
%if %{?suse_version: %{suse_version} > 1110} %{!?suse_version:1}
BuildArch:      noarch
%endif
%endif

%description
The argparse module provides an easy, declarative interface for
creating command line tools, which knows how to:

* parse the arguments and flags from sys.argv
* convert arg strings into objects for your program
* format and print informative help messages
* and much more... 

The argparse module improves on the standard library optparse module
in a number of ways including:

* handling positional arguments
* supporting sub-commands
* allowing alternative option prefixes like + and /
* handling zero-or-more and one-or-more style arguments
* producing more informative usage messages
* providing a much simpler interface for custom types and actions 

The latest version of argparse, along with API documentation and
examples can be found at:

  http://code.google.com/p/argparse/

Authors:
--------
    Steven Bethard <steven.bethard@gmail.com>

%package doc
License:        Apache
Summary:        Documentation and examples for %{name}
Group:          Development/Libraries/Python

%description doc
This package contains HTML and PDF documentation for %{name} as
well as examples of how to use them.


%prep
export CFLAGS="%{optflags}"
%setup -n %{mod_name}-%{version}
%{__mkdir} html
pushd doc
    # We don't want the source:
    %{__rm} -rf source
    %{__mv} * ../html/
    %{__mv} ../html .
popd
# Avoid warning wrong-file-end-of-line-encoding  
find doc/html/_static/pygments.css NEWS.txt README.txt -print0 | xargs -0 dos2unix
cp %{SOURCE1} doc/

%build
%{__python} setup.py build

%install
%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} %{?suse_version: --record-rpm=INSTALLED_FILES}

%clean
%{__rm} -rf %{buildroot}

%files %{?suse_version: -f INSTALLED_FILES}
%defattr(-,root,root,-)
%if 0%{!?suse_version:1}
%python_sitelib/%{mod_name}*
%endif

%files doc
%defattr(-,root,root)
%doc NEWS.txt README.txt doc/*

%changelog
openSUSE Build Service is sponsored by