1+ from setuptools import setup
2+ import re
3+
4+ requirements = []
5+ with open ('requirements.txt' ) as f :
6+ requirements = f .read ().splitlines ()
7+
8+ version = ''
9+ with open ('discordanalytics/__init__.py' ) as f :
10+ version = re .search (r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]' , f .read (), re .MULTILINE ).group (1 )
11+
12+ if not version :
13+ raise RuntimeError ('version is not set' )
14+
15+ if version .endswith (('a' , 'b' , 'rc' )):
16+ try :
17+ import subprocess
18+ p = subprocess .Popen (['git' , 'rev-list' , '--count' , 'HEAD' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
19+ out , err = p .communicate ()
20+ if out :
21+ version += out .decode ('utf-8' ).strip ()
22+ p = subprocess .Popen (['git' , 'rev-parse' , '--short' , 'HEAD' ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
23+ out , err = p .communicate ()
24+ if out :
25+ version += '+g' + out .decode ('utf-8' ).strip ()
26+ except Exception :
27+ pass
28+
29+ readme = ''
30+ with open ('README.md' ) as f :
31+ readme = f .read ()
32+
33+ packages = [
34+ 'discordanalytics'
35+ ]
36+
37+ setup (
38+ name = 'discordanalytics' ,
39+ author = 'ValDesign' ,
40+ url = 'https://github.com/DiscordAnalytics/python-package' ,
41+ project_urls = {
42+ 'Documentation' : 'https://docs.discordanalytics.xyz' ,
43+ 'Issue tracker' : 'https://github.com/DiscordAnalytics/python-package/issues'
44+ },
45+ version = version ,
46+ packages = packages ,
47+ license = 'MIT' ,
48+ description = 'A Python package for interacting with Discord Analytics API' ,
49+ long_description = readme ,
50+ long_description_content_type = 'text/markdown' ,
51+ include_package_data = True ,
52+ install_requires = requirements ,
53+ python_requires = '>=3.8.0'
54+ )
0 commit comments