chipsalliance / fasm

FPGA Assembly (FASM) Parser and Generator
https://fasm.readthedocs.io
Apache License 2.0
90 stars 30 forks source link

Adding generation of the version number. #53

Closed mithro closed 3 years ago

mithro commented 3 years ago

This pull request generate the version number of the package based on the git history.

Fixes #34.

Signed-off-by: Tim 'mithro' Ansell me@mith.ro

mithro commented 3 years ago

I'm not super happy about the way this works, but it does seem to work and I believe this is the final thing blocking uploading wheels / source / etc to PyPi.

mithro commented 3 years ago

It is also pretty clear that the antlr stuff should probably be moved into its own package which is an optional / recommended dependency of the base fasm package.

mithro commented 3 years ago

I'm wondering if we should use https://pypi.org/project/setuptools-scm/ -- I tried to use it a few years ago and was unhappy with it then but it seems to have improved a lot....

PyPI
setuptools-scm
the blessed package to manage your versions by scm tags
umarcor commented 3 years ago

If some reusable/external resource is to be created/used, I think it'd make sense to join forces with @Paebbels in https://github.com/Paebbels/pyVersioning.

GitHub
Paebbels/pyVersioning
Gather version information and export as any programming language source file for inclusion into compilation. - Paebbels/pyVersioning
Paebbels commented 3 years ago

The idea of pyVersioning is to have one script that collects version information from static config file, version control system or CI platform. Then a string or template file with Python's string formatting is used to replace fields. Because of this, any source file format can be generated. Examples .c, .h, *.vhdl, ...

The project is in a beta state and currently used in some customer projects at @PLC2.

From diffs, I saw, there is a need for author and comment information. The dataclass Commit can be extended for these fields. Currently, only Hash, Date and Time are implemented.

mithro commented 3 years ago

I think I'm going to land this CL for now and then convert to setuptools_scm potentially in the future.