def parse_version(root): from setuptools_scm import version_from_scm import setuptools_scm.git describe = setuptools_scm.git.DEFAULT_DESCRIBE + " --match 'apache-arrow-[0-9]*'" version = setuptools_scm.git.parse(root, describe) if not version: return version_from_scm(root) else: return version
def parse_version(root): from setuptools_scm import version_from_scm import setuptools_scm.git describe = setuptools_scm.git.DEFAULT_DESCRIBE + " --match 'apache-arrow-[0-9]*'" # Strip catchall from the commandline describe = describe.replace("--match *.*", "") version = setuptools_scm.git.parse(root, describe) if not version: return version_from_scm(root) else: return version
def test_version_from_scm(wd): with pytest.warns(DeprecationWarning, match=".*version_from_scm.*"): setuptools_scm.version_from_scm(str(wd))
#!/usr/bin/env python import sys from setuptools_scm import version_from_scm from setuptools_scm.version import guess_next_date_ver version = version_from_scm(".").tag.public version = guess_next_date_ver(version) version = version.rstrip(".0") if version.endswith(".0") else version print(version) sys.exit(0)
print('Importing definitions from setup.py...') spec = importlib.util.spec_from_file_location("setup", os.path.join(THIS_DIR, "setup.py")) setup_py = importlib.util.module_from_spec(spec) tmp = sys.argv # temporarily store the sys.argv to replace them during this call sys.argv = [tmp[0].replace('setup_cx_app.py', 'setup.py'), '--quiet', '--dry-run', 'clean'] # performs nothing, simply loads the variables defined in the script spec.loader.exec_module(setup_py) print('DONE, now executing setup_cx_app.py...') sys.argv = tmp # # you should pip install -e . before running this # import pkg_resources # part of setuptools # _app_version = pkg_resources.require("envswitch")[0].version # we have to manually create a version number compliant with cx_Freeze (no letters, just numbers) my_version = version_from_scm(THIS_DIR) if my_version is not None: THIS_TAG_OR_NEXT_TAG_VERSION = my_version.format_with("{tag}") with open('./' + version_file_cx_freeze, 'wt') as f: f.write(THIS_TAG_OR_NEXT_TAG_VERSION) else: print('WARNING: the version will not be retrieved from git but from the previously created ' + version_file_cx_freeze + ' file. This is ok if you ran python setup_cx_app.py build beforehand') THIS_TAG_OR_NEXT_TAG_VERSION = get_version() # turn this on to enable debug messages if you dont understand why such module is not imported # import logging # logging.getLogger().setLevel(logging.DEBUG) # ******** define what to include in the frozen version ********* files_to_include = ['LICENSE', 'LICENSE-PyQt', 'LICENSE-Qt', version_file_cx_freeze, 'README.md', 'envswitch/resources']