File intelhex.spec of Package intelhex

#
# spec file for package intelhex
#
# Copyright (c) 2025 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/
#


%define pythons python3
Name:           intelhex
Version:        2.3.0
Release:        2.1
Summary:        Library for Intel HEX Files Manipulations
License:        BSD-3-Clause
Group:          Development/Tools/Other
URL:            https://github.com/bialix/intelhex
Source:         https://github.com/bialix/intelhex/archive/%{version}.zip
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  python3-pip
BuildRequires:  python3-setuptools
BuildRequires:  unzip
BuildArch:      noarch

%description
Python implementation of Intel HEX file format allows you read, modify, write
hex files and convert them to binary form.

The Intel HEX file format widely used in microprocessors and microcontrollers
area as the de-facto standard for representation of code for programming
microelectronic devices.

This work implements an **intelhex** Python library to read, write,
create from scratch and manipulate data from HEX (also known as Intel HEX)
file format. These operations are provided by “IntelHex” class.

The distribution package also includes several convenience Python scripts
to do basic tasks that utilize this library. The “bin2hex.py” script
converts binary data to HEX, and the “hex2bin.py” works the other direction.
“hex2dump.py” converts data from HEX to a hexdump which is useful for
inspecting data, and “hexmerge.py” merges multiple HEX files into one.

%lang_package

%prep
%setup -q

%build
%pyproject_wheel

%install
%pyproject_install
dos2unix AUTHORS.rst NEWS.rst README.rst LICENSE.txt
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=%{buildroot}%{python_sitelib}
%python_exec intelhex/test.py

%files
%doc AUTHORS.rst NEWS.rst README.rst
%license LICENSE.txt
%{_bindir}/bin2hex.py
%{_bindir}/hex*.py
%{python_sitelib}/intelhex
%{python_sitelib}/intelhex-%{version}.dist-info

%changelog
* Tue Mar 11 2025 Steve Kowalik <steven.kowalik@suse.com>
- Sprinkle in python-rpm-macros, build/install with pyproject macros.
- Run fdupes.
- Run the testsuite.
- No more greedy globs for sitelib.
* Wed Jun 15 2022 Dirk Müller <dmueller@suse.com>
- update to 2.3.0:
  * Add IntelHex.find() method to find a given byte pattern. (Scott Armitage)
  * API changes: IntelHex.segments() method supports new optional parameter
  * min_gap to allow consolidation of segments with small but existing gaps
    into a single segment. Default value is 1. (Ryan Downing)
  * API changes: IntelHex.tofile() now supports the optional byte_count
    parameter from IntelHex.write_hex_file(). Only used if format = hex.
  * Fix Python 3.9 compatibility issue with 'array' module (Piotr Korowacki)
  * Fix installation for Python version taking setup rather from setuptools than
    distutils (Theo Sbrissa)
* Sun Aug 16 2020 Klaus Kämpf <kkaempf@suse.com>
- build with Python3
* Fri Jun  8 2018 kkaempf@suse.com
- Update to 2.2.1
  * Fixes for PyPI.
- Fix project URL
- Update to 2.2
  * API changes: IntelHex.write_hex_file method: added support for new
    parameter: eolstyle = native | CRLF. (Alexander Belchenko)
  * API changes: IntelHex.write_hex_file() method gets new optional
    parameter byte_count to specify how many bytes should be written to
    each data record in output file. Default value is 16. (patch from
    GitHub user erki1993)
  * Unit tests: Fixed xrange overflow test for Python 2.7 on 64-bit
    platforms. Use sys.maxint to ensure we trigger an exception. (Masayuki
    Takeda)
  * Script hexinfo.py: Python 3 compatibility for processing start address
    dict keys. (patch from GitHub user mentaal)
  * Added get_memory_size() method: approx memory footprint of IntelHex
    object plus data. (Alexander Belchenko)
  * Better compatibility with Python 3. (Alexander Belchenko)
- Update to 2.1
  * API changes: added IntelHex.segments() method that returns a list
    of ordered tuple objects, representing contiguous occupied data
    addresses. (Andrew Fernandes)
  * New command-line script hexinfo.py to print summary about hex files
    contents (file name, start address, address ranges covered by the
    data) in YAML format. (Andrew Fernandes)
  * Better Python 3 compatibility when hex2bin.py and bin2hex.py scripts
    are trying to read/write binary data from stdin or to stdout. (GitHub
    issue https://github.com/bialix/intelhex/issues/4)
  * The main activity of the IntelHex project slowly drifting towards
    GitHub - the main social network for OSS developers. I'd really like
    to get some help from additional maintainer though.
  * API changes: IntelHex.dump() method gets new optional parameters:
    width, withpadding to control generation of output text. (patch from
    GitHub user durexyl)
  * Script hex2dump.py gets new option --width to support corresponding
    parameter in IntelHex.dump() method.
- Update to 2.0
  * The same codebase can be run on both Python 2 (2.4-2.7) and Python 3
    (3.2+). No need to use 2to3.
  * compat.py: provide more helper functions and aliases to reduce
    changes required to convert python 2 compatible sources to python 3.
    The code becomes quite ugly, but such compatibility has its price.
  * Python 3 compatibility: tobinstr should return bytes not unicode
    string (Bug #1212698).
  * Python 2: better support for long int addresses (over 2GB) (Bug
    [#1408934])
* Fri Jul  1 2016 toddrme2178@gmail.com
- Fix Group tag.
* Tue May 27 2014 sbrabec@suse.cz
- Created new package, version 1.5.
openSUSE Build Service is sponsored by