Skip to content
Snippets Groups Projects
Commit aa250ad5 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'release-0.13.1' into 'main'

REL: begin new release cycle

See merge request !116
parents 9c1dc69c a57c544b
No related branches found
No related tags found
1 merge request!116REL: begin new release cycle
Pipeline #42015 passed
...@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. ...@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.13.1] - 2023-10-11 ##
### Fixed ###
* no Error when no configuration file is used
[Issue](https://gitlab.com/linkahead/linkahead-pylib/-/issues/107)
## [0.13.0] - 2023-10-10 ## ## [0.13.0] - 2023-10-10 ##
### Added ### ### Added ###
......
...@@ -20,6 +20,6 @@ authors: ...@@ -20,6 +20,6 @@ authors:
given-names: Stefan given-names: Stefan
orcid: https://orcid.org/0000-0001-7214-8125 orcid: https://orcid.org/0000-0001-7214-8125
title: CaosDB - Pylib title: CaosDB - Pylib
version: 0.13.0 version: 0.13.1
doi: 10.3390/data4020083 doi: 10.3390/data4020083
date-released: 2023-10-10 date-released: 2023-10-11
#!/bin/bash #!/bin/bash
rm -rf dist/ build/ .eggs/ rm -rf dist/ build/ .eggs/
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
python setup-caosdb.py sdist bdist_wheel export PKGNAME=caosdb
python setup.py sdist bdist_wheel
python -m twine upload dist/* python -m twine upload dist/*
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
#
"""linkahead"""
import os
import subprocess
import sys
from setuptools import find_packages, setup
########################################################################
# The following code is largely based on code in numpy
########################################################################
#
# Copyright (c) 2005-2019, NumPy Developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the NumPy Developers nor the names of any
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
########################################################################
ISRELEASED = False
MAJOR = 0
MINOR = 12
MICRO = 1
# Do not tag as pre-release until this commit
# https://github.com/pypa/packaging/pull/515
# has made it into a release. Probably we should wait for pypa/packaging>=21.4
# https://github.com/pypa/packaging/releases
PRE = "" # "dev" # e.g. rc0, alpha.1, 0.beta-23
if PRE:
VERSION = "{}.{}.{}-{}".format(MAJOR, MINOR, MICRO, PRE)
else:
VERSION = "{}.{}.{}".format(MAJOR, MINOR, MICRO)
# Return the git revision as a string
def git_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH', 'HOME']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env)
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
GIT_REVISION = out.strip().decode('ascii')
except (subprocess.SubprocessError, OSError):
GIT_REVISION = "Unknown"
return GIT_REVISION
def get_version_info():
# Adding the git rev number needs to be done inside write_version_py(),
# otherwise the import of linkahead.version messes up the build under
# Python 3.
FULLVERSION = VERSION
# Magic which is only really needed in the pipelines. Therefore: a lot of dark pipeline magic.
if os.path.exists('.git'):
GIT_REVISION = git_version()
elif os.path.exists('linkahead_pylib_commit'):
with open('linkahead_pylib_commit', 'r') as f:
GIT_REVISION = f.read().strip()
elif os.path.exists('src/linkahead/version.py'):
# must be a source distribution, use existing version file
try:
from linkahead.version import git_revision as GIT_REVISION
except ImportError:
raise ImportError("Unable to import git_revision. Try removing "
"src/linkahead/version.py and the build directory "
"before building.")
else:
GIT_REVISION = "Unknown"
if not ISRELEASED:
FULLVERSION += '.dev0+' + GIT_REVISION[:7]
return FULLVERSION, GIT_REVISION
def write_version_py(filename='src/linkahead/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM linkahead SETUP.PY
#
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s
if not release:
version = full_version
"""
FULLVERSION, GIT_REVISION = get_version_info()
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version': FULLVERSION,
'git_revision': GIT_REVISION,
'isrelease': str(ISRELEASED)})
finally:
a.close()
def setup_package():
# load README
with open("README.md", "r") as fh:
long_description = fh.read()
src_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")
sys.path.insert(0, src_path)
# Rewrite the version file everytime
write_version_py()
metadata = dict(
name='caosdb',
version=get_version_info()[0],
description='Deprecated! Please install linkahead.',
long_description=long_description,
long_description_content_type="text/markdown",
author='Timm Fitschen',
author_email='t.fitschen@indiscale.com',
url='https://www.linkahead.org',
license="AGPLv3+",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Operating System :: OS Independent",
"Topic :: Database",
"Topic :: Scientific/Engineering :: Information Analysis",
],
packages=find_packages('src'),
python_requires='>=3.7',
package_dir={'': 'src'},
install_requires=['lxml>=4.6.3',
"requests[socks]>=2.26",
"python-dateutil>=2.8.2",
'PyYAML>=5.4.1',
'future',
],
extras_require={'keyring': ['keyring>=13.0.0'],
'jsonschema': ['jsonschema>=4.4.0']},
setup_requires=["pytest-runner>=2.0,<3dev"],
tests_require=["pytest", "pytest-cov", "coverage>=4.4.2",
"jsonschema>=4.4.0"],
package_data={
'linkahead': ['cert/indiscale.ca.crt', 'schema-pycaosdb-ini.yml'],
},
scripts=["src/linkahead/utils/linkahead_admin.py"]
)
try:
setup(**metadata)
finally:
del sys.path[0]
return
if __name__ == '__main__':
setup_package()
...@@ -48,7 +48,7 @@ from setuptools import find_packages, setup ...@@ -48,7 +48,7 @@ from setuptools import find_packages, setup
ISRELEASED = True ISRELEASED = True
MAJOR = 0 MAJOR = 0
MINOR = 13 MINOR = 13
MICRO = 0 MICRO = 1
# Do not tag as pre-release until this commit # Do not tag as pre-release until this commit
# https://github.com/pypa/packaging/pull/515 # https://github.com/pypa/packaging/pull/515
# has made it into a release. Probably we should wait for pypa/packaging>=21.4 # has made it into a release. Probably we should wait for pypa/packaging>=21.4
...@@ -154,10 +154,16 @@ def setup_package(): ...@@ -154,10 +154,16 @@ def setup_package():
# Rewrite the version file everytime # Rewrite the version file everytime
write_version_py() write_version_py()
if 'PKGNAME' in os.environ and os.environ['PKGNAME'] == 'caosdb':
pname = 'caosdb'
pdesc = 'Deprecated! Please install linkahead.'
else:
pname = 'linkahead'
pdesc = 'Python Interface for LinkAhead'
metadata = dict( metadata = dict(
name='linkahead', name=pname,
version=get_version_info()[0], version=get_version_info()[0],
description='Python Interface for LinkAhead', description=pdesc,
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
author='Timm Fitschen', author='Timm Fitschen',
......
...@@ -29,10 +29,10 @@ copyright = '2023, IndiScale GmbH' ...@@ -29,10 +29,10 @@ copyright = '2023, IndiScale GmbH'
author = 'Daniel Hornung' author = 'Daniel Hornung'
# The short X.Y version # The short X.Y version
version = '0.13.0' version = '0.13.1'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
# release = '0.5.2-rc2' # release = '0.5.2-rc2'
release = '0.13.0' release = '0.13.1'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
......
This diff is collapsed.
...@@ -49,9 +49,7 @@ def configure(inifile): ...@@ -49,9 +49,7 @@ def configure(inifile):
Return a list of files which have successfully been parsed. Return a list of files which have successfully been parsed.
""" """
global _pycaosdbconf global _pycaosdbconf
if "_pycaosdbconf" not in globals(): if ("_pycaosdbconf" not in globals() or _pycaosdbconf is None):
_pycaosdbconf = None
if _pycaosdbconf is None:
_reset_config() _reset_config()
read_config = _pycaosdbconf.read(inifile) read_config = _pycaosdbconf.read(inifile)
validate_yaml_schema(config_to_yaml(_pycaosdbconf)) validate_yaml_schema(config_to_yaml(_pycaosdbconf))
...@@ -65,6 +63,8 @@ def configure(inifile): ...@@ -65,6 +63,8 @@ def configure(inifile):
def get_config(): def get_config():
global _pycaosdbconf global _pycaosdbconf
if ("_pycaosdbconf" not in globals() or _pycaosdbconf is None):
_reset_config()
return _pycaosdbconf return _pycaosdbconf
...@@ -130,6 +130,11 @@ def _read_config_files(): ...@@ -130,6 +130,11 @@ def _read_config_files():
# End: LinkAhead rename block ################################################## # End: LinkAhead rename block ##################################################
if "PYCAOSDBINI" in environ: if "PYCAOSDBINI" in environ:
if not isfile(expanduser(environ["PYCAOSDBINI"])):
raise RuntimeError(
f"No configuration file found at\n{expanduser(environ['PYCAOSDBINI'])}"
"\nwhich was given via the environment variable PYCAOSDBINI"
)
return_var.extend(configure(expanduser(environ["PYCAOSDBINI"]))) return_var.extend(configure(expanduser(environ["PYCAOSDBINI"])))
else: else:
if isfile(ini_user_caosdb): if isfile(ini_user_caosdb):
......
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
# ** end header # ** end header
# #
import pytest
import linkahead as db
from os import environ, getcwd, remove from os import environ, getcwd, remove
from os.path import expanduser, isfile, join from os.path import expanduser, isfile, join
import linkahead as db
import pytest
from pytest import raises from pytest import raises
...@@ -55,7 +56,8 @@ def test_config_ini_via_envvar(temp_ini_files): ...@@ -55,7 +56,8 @@ def test_config_ini_via_envvar(temp_ini_files):
environ["PYCAOSDBINI"] = "bla bla" environ["PYCAOSDBINI"] = "bla bla"
assert environ["PYCAOSDBINI"] == "bla bla" assert environ["PYCAOSDBINI"] == "bla bla"
# test wrong configuration file in envvar # test wrong configuration file in envvar
assert not expanduser(environ["PYCAOSDBINI"]) in db.configuration._read_config_files() with pytest.raises(RuntimeError):
db.configuration._read_config_files()
# test good configuration file in envvar # test good configuration file in envvar
environ["PYCAOSDBINI"] = "~/.pylinkahead.ini" environ["PYCAOSDBINI"] = "~/.pylinkahead.ini"
assert expanduser("~/.pylinkahead.ini") in db.configuration._read_config_files() assert expanduser("~/.pylinkahead.ini") in db.configuration._read_config_files()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment