|
1 | | -from typing import Final, Literal |
2 | | -from discordLevelingSystem import __source__ |
3 | | -from setuptools import setup, find_packages |
| 1 | +from setuptools import setup |
4 | 2 |
|
5 | | -def _get_readme(): |
6 | | - with open('README.md', encoding='utf-8') as fp: |
7 | | - return fp.read() |
8 | | - |
9 | | -def _version_info() -> str: |
10 | | - version = (1, 2, 0) |
11 | | - release_level: Literal['alpha', 'beta', 'rc', 'final'] = 'final' |
12 | | - |
13 | | - BASE: Final[str] = '.'.join([str(n) for n in version]) |
14 | | - |
15 | | - if release_level == 'final': |
16 | | - return BASE |
17 | | - else: |
18 | | - # try and get the last commit hash for a more precise version, if it fails, just use the basic version |
19 | | - try: |
20 | | - import subprocess |
21 | | - p = subprocess.Popen(['git', 'ls-remote', __source__, 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
22 | | - out, _ = p.communicate() |
23 | | - short_hash = out.decode('utf-8')[:7] |
24 | | - p.kill() |
25 | | - return BASE + f"{release_level}+{short_hash}" |
26 | | - except Exception: |
27 | | - print('discordLevelingSystem notification: An error occurred when attempting to get the last commit ID of the repo for a more precise version of the library. Returning base development version instead.') |
28 | | - return BASE + release_level |
29 | | - |
30 | | -classifiers = [ |
31 | | - 'Development Status :: 5 - Production/Stable', |
32 | | - 'Programming Language :: Python :: 3', |
33 | | - 'Programming Language :: Python :: 3.8', |
34 | | - 'Programming Language :: Python :: 3.9', |
35 | | - 'Programming Language :: Python :: 3.10', |
36 | | - 'Topic :: Software Development :: Libraries', |
37 | | - 'Topic :: Software Development :: Libraries :: Python Modules' |
38 | | -] |
39 | | - |
40 | | -tags = [ |
41 | | - 'database', |
42 | | - 'discord', |
43 | | - 'discord bot', |
44 | | - 'discord.py', |
45 | | - 'discord py', |
46 | | - 'discord level', |
47 | | - 'discord leveling', |
48 | | - 'discord leveling system', |
49 | | - 'level', |
50 | | - 'levels', |
51 | | - 'leveling', |
52 | | - 'level up', |
53 | | - 'level system', |
54 | | - 'mee6', |
55 | | - 'rank', |
56 | | - 'ranking', |
57 | | - 'role award', |
58 | | - 'xp' |
59 | | -] |
60 | | - |
61 | | -details = { |
62 | | - 'Changelog' : 'https://github.com/Defxult/discordLevelingSystem/blob/main/CHANGELOG.md' |
63 | | -} |
64 | | - |
65 | | -setup( |
66 | | - author='Defxult#8269', |
67 | | - name='discordLevelingSystem', |
68 | | - description='A library to implement a leveling system into a discord bot. Contains features such as XP, level, ranks, and role awards.', |
69 | | - version=_version_info(), |
70 | | - url='https://github.com/Defxult/discordLevelingSystem', |
71 | | - project_urls=details, |
72 | | - classifiers=classifiers, |
73 | | - long_description=_get_readme(), |
74 | | - long_description_content_type='text/markdown', |
75 | | - license='MIT', |
76 | | - keywords=tags, |
77 | | - packages=find_packages(), |
78 | | - install_requires=['aiosqlite>=0.17.0', 'discord.py>=2.0.0'] |
79 | | -) |
| 3 | +if __name__ == "__main__": |
| 4 | + setup() |
0 commit comments