Skip to content

bindings/python: sync version with core via CMakeLists.txt#2301

Closed
Jvlegod wants to merge 1 commit intounicorn-engine:masterfrom
Jvlegod:fix-python-version
Closed

bindings/python: sync version with core via CMakeLists.txt#2301
Jvlegod wants to merge 1 commit intounicorn-engine:masterfrom
Jvlegod:fix-python-version

Conversation

@Jvlegod
Copy link
Copy Markdown

@Jvlegod Jvlegod commented Mar 4, 2026

Hello maintainers,

I encountered issues while compiling the Python RPM package for the distribution and attempting to compile it from source.

errors

from RPM compile

We should notice that Error: The version in the Python package metadata 0.0.0 normalizes to zero.

c33714aefaf3e9307edf8c8618cff379

from Source compile

I use setup.py to compile a tar.gz file.

I discovered that the Unicorn version was set to 0.0.0 because the Python bindings did not determine their version during the package compilation process, unlike other language interfaces.

...
copying unicorn/tricore_const.py -> unicorn-0.0.0/unicorn
copying unicorn/unicorn.py -> unicorn-0.0.0/unicorn
copying unicorn/unicorn_const.py -> unicorn-0.0.0/unicorn
copying unicorn/unicorn_py2.py -> unicorn-0.0.0/unicorn
copying unicorn/x86_const.py -> unicorn-0.0.0/unicorn
copying unicorn.egg-info/PKG-INFO -> unicorn-0.0.0/unicorn.egg-info
copying unicorn.egg-info/SOURCES.txt -> unicorn-0.0.0/unicorn.egg-info
copying unicorn.egg-info/dependency_links.txt -> unicorn-0.0.0/unicorn.egg-info
copying unicorn.egg-info/requires.txt -> unicorn-0.0.0/unicorn.egg-info
copying unicorn.egg-info/top_level.txt -> unicorn-0.0.0/unicorn.egg-info
copying unicorn/unicorn_py3/__init__.py -> unicorn-0.0.0/unicorn/unicorn_py3
copying unicorn/unicorn_py3/unicorn.py -> unicorn-0.0.0/unicorn/unicorn_py3
copying unicorn/unicorn_py3/arch/__init__.py -> unicorn-0.0.0/unicorn/unicorn_py3/arch
copying unicorn/unicorn_py3/arch/arm.py -> unicorn-0.0.0/unicorn/unicorn_py3/arch
copying unicorn/unicorn_py3/arch/arm64.py -> unicorn-0.0.0/unicorn/unicorn_py3/arch
copying unicorn/unicorn_py3/arch/intel.py -> unicorn-0.0.0/unicorn/unicorn_py3/arch
copying unicorn/unicorn_py3/arch/types.py -> unicorn-0.0.0/unicorn/unicorn_py3/arch
copying unicorn.egg-info/SOURCES.txt -> unicorn-0.0.0/unicorn.egg-info
Writing unicorn-0.0.0/setup.cfg
creating dist
Creating tar archive
removing 'unicorn-0.0.0' (and everything under it)

my change

I have implemented a function in setup.py to automatically retrieve the version, which depends on the top-level CMakeLists.txt. I believe this is a reasonable approach because the version-related variables in CMake are highly stable; my observations show that this section of the CMake code hasn't changed significantly since version 1.0.2-rc1. Additionally, I have included a fallback var using a DEFAULT_VERSION variable to specify the version if needed.

:>

Signed-off-by: Jvle <keke.oerv@isrc.iscas.ac.cn>
@Jvlegod Jvlegod closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant