forked from pool/python-cstruct
- Add patch support-python314.patch:
* Do not support now-removed ast.{Num,Str}.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cstruct?expand=0&rev=20
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
3
python-cstruct-6.1.tar.gz
Normal file
3
python-cstruct-6.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3c4f70a8adfaca32542af481bdd58e10b5224d8dc34340e018b940b8b730c060
|
||||
size 41085
|
||||
90
python-cstruct.changes
Normal file
90
python-cstruct.changes
Normal file
@@ -0,0 +1,90 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 21 02:43:47 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-python314.patch:
|
||||
* Do not support now-removed ast.{Num,Str}.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jul 12 17:30:43 UTC 2025 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 6.1:
|
||||
* fix CStruct.pack() padding
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 16 06:12:20 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Switch to pyroject macros.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 8 20:58:43 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 5.3:
|
||||
* fix struct in struct array parsing
|
||||
* Python 3.12 support
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 6 01:00:29 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
|
||||
|
||||
- Update to version 5.2
|
||||
Fix
|
||||
- nested struct unpack fix
|
||||
- nested anonymous union offset fix
|
||||
- inspect offset for nested struct/union fix
|
||||
|
||||
- Update to version 5.1
|
||||
Improved
|
||||
* Support unpack from ctype pointers
|
||||
Added
|
||||
* Add support for char constants
|
||||
* Add native type test
|
||||
* dir.py example
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Nov 12 11:16:08 UTC 2022 - Martin Hauke <mardnh@gmx.de>
|
||||
|
||||
- Update to version 5.0
|
||||
* Add support for enums
|
||||
* Add support for multiple definition to cstruct.parse
|
||||
* Add inspect method
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 4 19:12:43 UTC 2022 - Martin Hauke <mardnh@gmx.de>
|
||||
|
||||
- Update to version 4.0
|
||||
* Add enum support to cstruct.parse
|
||||
* Add typedef parsing
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 24 15:29:46 UTC 2022 - Martin Hauke <mardnh@gmx.de>
|
||||
|
||||
- Update to version 3.3
|
||||
* Fix tests on 32bit architecture
|
||||
- Update to version 3.2
|
||||
* Add more tests
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 14 13:45:17 UTC 2022 - Martin Hauke <mardnh@gmx.de>
|
||||
|
||||
- Update to version 3.1
|
||||
* Make CStruct/MemCStruct Pickle Friendly
|
||||
- Update to version 3.0
|
||||
* Flexible array support
|
||||
- Update to version 2.3
|
||||
* Fix compare with None
|
||||
- Update to version 2.2
|
||||
Fixes
|
||||
* Fix empty MemCStruct size
|
||||
Improvements
|
||||
* Python 3.10 support
|
||||
* pytest
|
||||
* black code style
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 13 07:17:06 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- use https for urls
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 13 20:29:38 UTC 2020 - Martin Hauke <mardnh@gmx.de>
|
||||
|
||||
- Initial package, version 1.8
|
||||
67
python-cstruct.spec
Normal file
67
python-cstruct.spec
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# spec file for package python-cstruct
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC and contributors
|
||||
# Copyright (c) 2020-2022, Martin Hauke <mardnh@gmx.de>
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
|
||||
|
||||
Name: python-cstruct
|
||||
Version: 6.1
|
||||
Release: 0
|
||||
Summary: C-style structs for Python
|
||||
License: MIT
|
||||
URL: https://github.com/andreax79/python-cstruct
|
||||
Source: https://github.com/andreax79/python-cstruct/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Patch0: support-python314.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Convert C struct definitions into Python classes with methods for
|
||||
serializing/deserializing. The usage is very simple: create a class
|
||||
subclassing cstruct.CStruct and add a C struct definition as a
|
||||
string in the struct field. The C struct definition is parsed at
|
||||
runtime and the struct format string is generated. The class offers
|
||||
the method "unpack" for deserializing a string of bytes into a
|
||||
Python object and the method "pack" for serializing the values into
|
||||
a string.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_expand find %{buildroot}%{$python_sitelib} -name "*.py" -exec sed -i -e '/^#!\//, 1d' {} \;
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc changelog.txt README.md
|
||||
%{python_sitelib}/cstruct
|
||||
%{python_sitelib}/cstruct-%{version}.dist-info
|
||||
|
||||
%changelog
|
||||
16
support-python314.patch
Normal file
16
support-python314.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
Index: python-cstruct-6.1/cstruct/c_expr.py
|
||||
===================================================================
|
||||
--- python-cstruct-6.1.orig/cstruct/c_expr.py
|
||||
+++ python-cstruct-6.1/cstruct/c_expr.py
|
||||
@@ -167,11 +167,9 @@ except AttributeError: # python < 3.8
|
||||
|
||||
OPS: Dict[Type[ast.AST], Callable[[Any], Any]] = {
|
||||
ast.Expr: lambda node: eval_node(node.value),
|
||||
- ast.Num: lambda node: node.n,
|
||||
ast.Name: eval_get,
|
||||
ast.Call: eval_call,
|
||||
Constant: lambda node: node.value,
|
||||
- ast.Str: lambda node: node.s, # python < 3.8
|
||||
# and/or
|
||||
ast.BoolOp: lambda node: OPS[type(node.op)](node), # and/or operator
|
||||
ast.And: lambda node: all(eval_node(x) for x in node.values), # && operator
|
||||
Reference in New Issue
Block a user