-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
64 lines (50 loc) · 1.64 KB
/
Copy pathsetup.py
File metadata and controls
64 lines (50 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import setuptools
import urllib.request
import json
from pkg_resources import parse_version
MANUAL_VERSION = None
def list_versions(package_name):
url = f"https://pypi.org/pypi/{package_name}/json"
with urllib.request.urlopen(url) as res:
data = json.loads(res.read().decode('utf-8'))
versions = data['releases']
return sorted(versions, key=parse_version, reverse=True)
def version(new_version: bool = False) -> str:
"""
Returns version of the new package, by elevating the version of the old package. Or returns the
manual version.
"""
versions = list_versions('baca2-package-manager')
v = versions[0]
if len(versions) == 0:
v = '0.0.1'
if not new_version:
return v
if MANUAL_VERSION is not None:
mv = MANUAL_VERSION
if mv not in versions:
v = mv
new_v = v.split('.')
new_v[-1] = str(int(new_v[-1]) + 1)
new_v = '.'.join(new_v)
return new_v
setuptools.setup(
name='baca2-package-manager',
version=version(new_version=True),
author='Baca2 Team',
author_email='bartosz.deptula@student.uj.edu.pl',
description='A package manager for Baca2 project',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/BaCa2-project/BaCa2-package-manager',
packages=setuptools.find_packages(),
classifiers=[
'Programming Language :: Python :: 3',
'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
],
python_requires='>=3.11',
install_requires=[
'pyyaml',
]
)