File totalopenstation.spec of Package totalopenstation

#
# spec file for package totalopenstation
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           totalopenstation
Version:        0.5.2
Release:        0
Summary:        Download and export survey data from your total station
License:        GPL-3.0
URL:            https://tops.iosa.it/
Source:         https://github.com/totalopenstation/totalopenstation/archive/refs/tags/v%{version}.tar.gz#/totalopenstation-%{version}.tar.gz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildArch:      noarch
Provides:       TotalOpenStation = %{version}
Obsoletes:      TotalOpenStation < %{version}
Requires(post):   update-alternatives
Requires(postun):  update-alternatives

%python_subpackages

%description
Total Open Station is a program for downloading and processing survey data from total station devices.

Total Open Station is a good choice if:

- you work with total stations on GNU/Linux (and MacOS, probably)
- you work with old devices that are unsupported by vendors
- you need to process hundreds of data files at once

We think Total Open Station is small but great because:

- it is *free/libre open source software*
- it works on *any* operating system where Python is available
- it is designed to support as many devices and formats as possible, all
  within the same program, opposed to having one program per device
- it works both on the command line and with a graphical interface

Total Open Station uses a modular structure and
keeps the downloading of data logically separated from its processing,
thus enabling exporting data to a variety of output formats, even at a
later moment. Archiving of raw data is made easy by using plain text
files.

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

find totalopenstation/output totalopenstation/formats totalopenstation/models totalopenstation/utils -type f -name "*.py" -exec sed -i 's@/usr/bin/env.*@@g' {} ';'

%build
%python_build

%post
%{python_install_alternative totalopenstation-cli-connector.py totalopenstation-cli-parser.py totalopenstation-gui.py}

%postun
%{python_uninstall_alternative totalopenstation-cli-connector.py totalopenstation-cli-parser.py totalopenstation-gui.py}

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/totalopenstation-cli-connector.py
%python_clone -a %{buildroot}%{_bindir}/totalopenstation-cli-parser.py
%python_clone -a %{buildroot}%{_bindir}/totalopenstation-gui.py

%files %{python_files}
%{python_sitelib}/*
%python_alternative %_bindir/totalopenstation-cli-connector.py
%python_alternative %_bindir/totalopenstation-cli-parser.py
%python_alternative %_bindir/totalopenstation-gui.py

%changelog
openSUSE Build Service is sponsored by