Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
[build-system]
requires = ["setuptools", "wheel", "cython"]
requires = [
"cython",
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"wheel",
]

[tool.setuptools_scm]
version_scheme = "post-release"
write_to = "fasm/version.py"
tag_regex = "v[0-9.]+"
10 changes: 7 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
check-manifest
# Required for fasm tooling
cython
setuptools>=42
setuptools_scm[toml]>=3.4
textx
wheel
# Testing
check-manifest
flake8
pytest
textx
tox
twine
wheel
yapf==0.24.0
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[metadata]
license_files = LICENSE

[bdist_wheel]
universal=1
[options]
setup_requires =
wheel
setuptools
setuptools_scm
51 changes: 31 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,19 @@
with open("README.md", "r") as fh:
long_description = fh.read()

# Read in the version information
FASM_VERSION_FILE = os.path.join(__dir__, 'fasm', 'version.py')
with open(FASM_VERSION_FILE) as f:
if 'UNKNOWN' in f.read():
print(
"Running update_version.py to generate {}".format(
FASM_VERSION_FILE))
subprocess.check_call(['python', 'update_version.py'], cwd=__dir__)
with open(FASM_VERSION_FILE) as f:
lines = f.readlines()
version_line = [v.strip() for v in lines if v.startswith('version_str')]
assert len(version_line) == 1, version_line
version_value = version_line[0].split(' = ', 1)[-1]
assert version_value[0] == '"', version_value
assert version_value[-1] == '"', version_value
version = version_value[1:-1]

# Generate the version number
def scm_version():
def local_scheme(version):
if version.tag and not version.distance:
return version.format_with("")
else:
return version.format_choice("+{node}", "+{node}.dirty")
return {
"relative_to": __file__,
"version_scheme": "guess-next-dev",
"local_scheme": local_scheme
}


# Based on: https://www.benjack.io/2018/02/02/python-cpp-revisited.html
Expand Down Expand Up @@ -253,25 +250,39 @@ def run(self):


setuptools.setup(
# Package human readable information
name="fasm",
version=version,
use_scm_version=scm_version(),
author="SymbiFlow Authors",
author_email="[email protected]",
description="FPGA Assembly (FASM) Parser and Generation library",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/SymbiFlow/fasm",
packages=setuptools.find_packages(exclude=('tests*', )),
install_requires=['textx'],
include_package_data=True,
license="ISC",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: ISC License (ISCL)",
"Operating System :: OS Independent",
],
# Package contents control
packages=setuptools.find_packages(exclude=['tests*']),
include_package_data=True,
entry_points={
'console_scripts': ['fasm=fasm.tool:main'],
},
# Requirements
python_requires="~=3.6",
setup_requires=[
"wheel",
"setuptools",
"setuptools_scm",
],
install_requires=[
"importlib_metadata; python_version<'3.8'", # for __version__
'textx',
],
# C extension building
ext_modules=[
CMakeExtension('parse_fasm', sourcedir='src', prefix='fasm/parser')
] + cythonize("fasm/parser/antlr_to_tuple.pyx"),
Expand Down
151 changes: 0 additions & 151 deletions update_version.py

This file was deleted.