File nwdiag.spec of Package nwdiag

# vim: set sw=4 ts=4 et nu:

# Copyright (c) 2013 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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:               nwdiag
Version:            0.9.4
Release:            0
Summary:            Generate Network Diagrams from Specification Text File
Source:             https://pypi.python.org/packages/source/n/nwdiag/nwdiag-%{version}.tar.gz
Source99:           %{name}.rpmlintrc
URL:                http://blockdiag.com/en/nwdiag/index.html
Group:              Development/Tools/Other
License:            Apache-2.0
BuildRoot:          %{_tmppath}/build-%{name}-%{version}
BuildRequires:      python-devel >= 2.4
BuildRequires:      python-setuptools
%{!?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))")}
%if 0%{?suse_version} >= 1120
BuildArch:          noarch
%endif
%py_requires
BuildRequires:      python-imaging
Requires:           python-imaging
Provides:           packetdiag = %{version}
Provides:           rackdiag = %{version}

%description
nwdiag generates network-diagram image files from spec-text file.

Features:
* Generate network-diagram from dot like text (basic feature)
* Multilingualization for node-label (utf-8 only)

%prep
%setup -q
%__sed -i 's/\r$//' src/*.txt

%build
%__python ./setup.py build

%install
%__python ./setup.py install \
    --prefix="%{_prefix}" \
    --root="%{buildroot}" \
    --record-rpm=files.lst

# want to track those "manually" in the files list
%__perl -n -i -e 'print unless m,^\Q%{_bindir}/\E,' files.lst

%__rm -rf "%{buildroot}%{python_sitelib}"/*/tests
%__perl -n -i -e 'print unless m,^(%dir\s+)?\Q%{python_sitelib}\E/[^/]+/tests,' files.lst

%clean
%{?buildroot:%__rm -rf "%{buildroot}"}

%files -f files.lst
%defattr(-,root,root)
%doc LICENSE src/README.txt
%{_bindir}/nwdiag
%{_bindir}/packetdiag
%{_bindir}/rackdiag

%changelog
openSUSE Build Service is sponsored by