Added versioning based off of discord.py versioning
This commit is contained in:
parent
535c3bfe79
commit
8928b7b6f2
|
|
@ -18,7 +18,7 @@ if not discord.__version__.startswith("2.0"):
|
||||||
"Uninstall your current version and install discord.py 2.0 or a compatible fork."
|
"Uninstall your current version and install discord.py 2.0 or a compatible fork."
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "1.1.7"
|
__version__ = "1.1.7b"
|
||||||
__title__ = "pomice"
|
__title__ = "pomice"
|
||||||
__author__ = "cloudwithax"
|
__author__ = "cloudwithax"
|
||||||
|
|
||||||
|
|
|
||||||
27
setup.py
27
setup.py
|
|
@ -1,4 +1,29 @@
|
||||||
import setuptools
|
import setuptools
|
||||||
|
import re
|
||||||
|
|
||||||
|
version = ''
|
||||||
|
with open('pomice/__init__.py') as f:
|
||||||
|
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
|
||||||
|
|
||||||
|
if not version:
|
||||||
|
raise RuntimeError('version is not set')
|
||||||
|
|
||||||
|
if version.endswith(('a', 'b', 'rc')):
|
||||||
|
# append version identifier based on commit count
|
||||||
|
try:
|
||||||
|
import subprocess
|
||||||
|
p = subprocess.Popen(['git', 'rev-list', '--count', 'HEAD'],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if out:
|
||||||
|
version += out.decode('utf-8').strip()
|
||||||
|
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if out:
|
||||||
|
version += '+g' + out.decode('utf-8').strip()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
with open("requirements.txt") as f:
|
with open("requirements.txt") as f:
|
||||||
requirements = f.read().splitlines()
|
requirements = f.read().splitlines()
|
||||||
|
|
@ -9,7 +34,7 @@ with open("README.md") as f:
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="pomice",
|
name="pomice",
|
||||||
author="cloudwithax",
|
author="cloudwithax",
|
||||||
version="1.1.7",
|
version=version,
|
||||||
url="https://github.com/cloudwithax/pomice",
|
url="https://github.com/cloudwithax/pomice",
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
license="GPL",
|
license="GPL",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue