Skip to content
Snippets Groups Projects
Commit 7b52dc1b authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

setup: use setup.cfg & setuptools_scm

parent 24c32a1d
No related branches found
No related tags found
1 merge request!134Use setuptools & setuptools_scm
syntax: re
^hggit/__version__\.py$
syntax: glob
*.pyc
tests/*.err
......
......@@ -150,6 +150,8 @@
from . import schemes
from . import templates
import dulwich
from mercurial import (
demandimport,
exthelper,
......@@ -160,8 +162,6 @@
b'collections',
}
__version__ = b'0.11.0dev'
testedwith = (b'5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0')
minimumhgversion = b'5.2'
buglink = b'https://foss.heptapod.net/mercurial/hg-git/issues'
......@@ -194,6 +194,28 @@
def getversion():
"""return version with dependencies for hg --version -v"""
import dulwich
dulver = b'.'.join(pycompat.sysbytes(str(i)) for i in dulwich.__version__)
return __version__ + (b" (dulwich %s)" % dulver)
# first, try to get a built version
try:
from .__version__ import version
except ImportError:
version = None
# if that fails, try to determine the version from the checkout
if version is None:
try:
from setuptools_scm import get_version
version = get_version(
root='..',
relative_to=__file__,
version_scheme="release-branch-semver",
)
except:
# something went wrong, but we need to provide something
version = "unknown"
# include the dulwich version, as it's fairly important for the
# level of functionality
dulver = '.'.join(map(str, dulwich.__version__))
return pycompat.sysbytes("%s (dulwich %s)" % (version, dulver))
[build-system]
requires = [
"setuptools >= 42",
"setuptools_scm[toml]>=6.0",
"wheel",
]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "hggit/__version__.py"
version_scheme = "release-branch-semver"
[metadata]
name = hg-git
author = Scott Chacon, Augie Fackler, Kevin Bullock and others
maintainer = The hg-git maintainers
maintainer_email = hg-git@googlegroups.com
url = http://foss.heptapod.net/mercurial/hg-git
description = push to and pull from a Git repository using Mercurial
long_description = file:README.rst
keywords = hg git mercurial
license = GPLv2
[options]
include_package_data=True
zip_safe=False
python_requires = >=3.6
packages = hggit
install_requires=
dulwich>=0.19.3
[options.package_data]
* = *.txt, *.rst
[flake8]
# E,W will ignore all pep8
ignore=E129
......
from __future__ import generator_stop
from os.path import dirname, join
import setuptools
try:
......@@ -4,20 +2,7 @@
try:
from setuptools import setup
except:
from distutils.core import setup
def get_file(relpath):
root = dirname(__file__)
with open(join(root, relpath)) as fp:
return fp.read().strip()
def get_version(relpath):
for line in get_file(relpath).splitlines():
line = line
if '__version__' in line:
return line.split("'")[1]
import setuptools_scm
assert setuptools_scm # silence pyflakes
except ImportError:
pass
......@@ -23,20 +8,2 @@
setup(
name='hg-git',
version=get_version('hggit/__init__.py'),
author='The hg-git Authors',
maintainer='Kevin Bullock',
maintainer_email='kbullock+mercurial@ringworld.org',
url='http://foss.heptapod.net/mercurial/hg-git',
description='push to and pull from a Git repository using Mercurial',
long_description=get_file("README.rst"),
keywords='hg git mercurial',
license='GPLv2',
packages=['hggit'],
include_package_data=True,
zip_safe=True,
python_requires='>=3.6',
install_requires=[
'dulwich>=0.19.3',
],
)
setuptools.setup()
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