Commit a9484ea9 authored by Vuillaume's avatar Vuillaume
Browse files

Merge branch 'autoversioning' into 'master'

autoversioning from git tags

See merge request !202
parents 17f516a8 995ae8bd
Pipeline #175215 failed with stages
in 1 minute and 32 seconds
......@@ -9,6 +9,7 @@ __pycache__
*.egg-info
dist
build
_version.py
# Mac OSX
.DS_Store
......
......@@ -109,8 +109,9 @@ deploy_zenodo:
dependencies:
- build_docker
before_script:
- pip install .
- python eossr/scripts/update_codemeta_eossr.py
- eossr-check-connection-zenodo --token $ZENODO_TOKEN -p $CI_PROJECT_DIR
- mkdir -p /zenodo_build
script:
- eossr-upload-repository -t $ZENODO_TOKEN -i $CI_PROJECT_DIR --archive-name $CI_PROJECT_NAME.zip -id $ZENODO_RECORD_ID
only:
......
from pathlib import Path
from .version import __version__ # noqa
ROOT_DIR = Path(__file__).absolute().parents[1]
__version__ = "0.6"
# Try to use setuptools_scm to get the current version; this is only used
# in development installations from the git repository.
# see eossr/version.py for details
from .. import ROOT_DIR
try:
from setuptools_scm import get_version
version = get_version(root=ROOT_DIR)
except Exception as e:
raise ImportError(f"setuptools_scm broken or not installed: {e}")
from pathlib import Path
import eossr
from eossr.metadata import codemeta
......@@ -7,3 +8,7 @@ def test_eossr_codemeta():
eossr_codemeta_file = Path(__file__).parent.joinpath('../../codemeta.json').resolve()
codemeta_handler = codemeta.Codemeta.from_file(eossr_codemeta_file)
codemeta_handler.validate()
def test_version():
assert eossr.__version__ != "0.0.0"
# this is adapted from https://github.com/astropy/astropy/blob/master/astropy/version.py
# see https://github.com/astropy/astropy/pull/10774 for a discussion on why this needed.
try:
try:
from ._dev_version import version
except ImportError:
from ._version import __version__ as version
except Exception as e:
import warnings
warnings.warn(
"Could not determine eossr version; this indicates a broken installation."
" Install eossr from PyPI, a local git repository or using "
" pip install git+https://gitlab.in2p3.fr/escape2020/wp3/eossr@VERSION "
" Installing github's autogenerated source release tarballs "
" does not include version information and should be avoided."
f"Exception Error: {e}"
)
del warnings
version = "0.0.0"
__version__ = version
#!/usr/bin/env python
import re
from pathlib import Path
from setuptools import find_packages, setup
......@@ -16,18 +15,12 @@ entry_points = {
}
def get_version(file=Path(__file__).parent.joinpath('eossr/__init__.py')):
result = re.search(r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format('__version__'), open(file).read())
return result.group(1)
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name='eossr',
version=get_version(),
description="ESCAPE OSSR library",
long_description=long_description,
long_description_content_type='text/markdown',
......@@ -37,9 +30,10 @@ setup(
"markdown>=3.3.6,<4.0",
"pandas",
"remotezip==0.9.3",
"setuptools_scm",
],
extras_require={'tests': ['pytest', 'pytest-cov'], 'extras': ['pre-commit']},
packages=find_packages(),
packages=find_packages(exclude="eossr._dev_version"),
scripts=[],
tests_require=['pytest'],
author='Thomas Vuillaume, Enrique Garcia',
......@@ -54,4 +48,8 @@ setup(
'metadata/schema/escape_codemeta_crosswalk.csv',
]
},
use_scm_version={
"write_to": Path(__file__).parent.joinpath("eossr/_version.py"),
"write_to_template": "__version__ = '{version}'",
},
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment