diff --git a/Makefile b/Makefile index abd240b51..b468e648c 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,17 @@ clean: partial_clean rm -rf $(DEPOSIT_CONTRACT_COMPILER_DIR)/venv rm -rf $(DEPOSIT_CONTRACT_TESTER_DIR)/venv +# The pyspec is rebuilt to enforce the /specs being part of eth2specs source distribution. It could be forgotten otherwise. +dist_build: pyspec + python3 setup.py sdist bdist_wheel + +dist_check: + python3 -m twine check dist/* + +dist_upload: + python3 -m twine upload dist/* + + # "make generate_tests" to run all generators generate_tests: $(GENERATOR_TARGETS) diff --git a/setup.py b/setup.py index 23cad7dfa..444489d2e 100644 --- a/setup.py +++ b/setup.py @@ -428,9 +428,20 @@ commands = { with open("README.md", "rt", encoding="utf8") as f: readme = f.read() +# How to use "VERSION.txt" file: +# - dev branch contains "X.Y.Z.dev", where "X.Y.Z" is the target version to release dev into. +# -> Changed as part of 'master' backport to 'dev' +# - master branch contains "X.Y.Z", where "X.Y.Z" is the current version. +# -> Changed as part of 'dev' release (or other branch) into 'master' +# -> In case of a commit on master without git tag, target the next version +# with ".postN" (release candidate, numbered) suffixed. +# See https://www.python.org/dev/peps/pep-0440/#public-version-identifiers +with open(os.path.join('tests', 'core', 'pyspec', 'eth2spec', 'VERSION.txt')) as f: + spec_version = f.read().strip() + setup( name='eth2spec', - version='0.0.1', # initial version, see #1584 and #1596 + version=spec_version, description="Eth2 spec, provided as Python package for tooling and testing", long_description=readme, long_description_content_type="text/markdown", @@ -438,7 +449,8 @@ setup( url="https://github.com/ethereum/eth2.0-specs", include_package_data=False, package_data={'configs': ['*.yaml'], - 'specs': ['**/*.md']}, + 'specs': ['**/*.md'], + 'eth2spec': ['VERSION.txt']}, package_dir={ "eth2spec": "tests/core/pyspec/eth2spec", "configs": "configs", diff --git a/tests/core/pyspec/eth2spec/VERSION.txt b/tests/core/pyspec/eth2spec/VERSION.txt new file mode 100644 index 000000000..9f20097b6 --- /dev/null +++ b/tests/core/pyspec/eth2spec/VERSION.txt @@ -0,0 +1 @@ +0.10.2.dev0 \ No newline at end of file diff --git a/tests/core/pyspec/eth2spec/__init__.py b/tests/core/pyspec/eth2spec/__init__.py index e69de29bb..6941b68f0 100644 --- a/tests/core/pyspec/eth2spec/__init__.py +++ b/tests/core/pyspec/eth2spec/__init__.py @@ -0,0 +1,3 @@ +# See setup.py about usage of VERSION.txt +with open('VERSION.txt') as f: + __version__ = f.read().strip()