__revision_id__ = "$Id$"
[PyOpenCNAM.git] / setup.py
blobaeeafaeed4e10f8386c7511ea2f7fb6764e7ddf0
1 #!/usr/bin/env python
3 '''
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the Revised BSD License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 Revised BSD License for more details.
12 Copyright 2020 Cool Dude 2k - http://idb.berlios.de/
13 Copyright 2020 Game Maker 2k - http://intdb.sourceforge.net/
14 Copyright 2020 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16 $FileInfo: setup.py - Last Update: 1/20/2020 Ver. 1.2.0 RC 1 - Author: cooldude2k $
17 '''
19 import re
20 import os
21 import sys
22 import time
23 import datetime
24 import platform
25 import pkg_resources
26 from setuptools import setup, find_packages
28 verinfofilename = os.path.realpath("."+os.path.sep+os.path.sep+"pyopencnam.py")
29 verinfofile = open(verinfofilename, "r")
30 verinfodata = verinfofile.read()
31 verinfofile.close()
32 setuppy_verinfo_esc = re.escape("__version_info__ = (")+"(.*)"+re.escape(");")
33 setuppy_verinfo = re.findall(setuppy_verinfo_esc, verinfodata)[0]
34 setuppy_verinfo_exp = [vergetspt.strip().replace("\"", "")
35 for vergetspt in setuppy_verinfo.split(',')]
36 setuppy_dateinfo_esc = re.escape(
37 "__version_date_info__ = (")+"(.*)"+re.escape(");")
38 setuppy_dateinfo = re.findall(setuppy_dateinfo_esc, verinfodata)[0]
39 setuppy_dateinfo_exp = [vergetspt.strip().replace("\"", "")
40 for vergetspt in setuppy_dateinfo.split(',')]
41 pymodule = {}
42 pymodule['version'] = str(setuppy_verinfo_exp[0])+"." + \
43 str(setuppy_verinfo_exp[1])+"."+str(setuppy_verinfo_exp[2])
44 pymodule['versionrc'] = int(setuppy_verinfo_exp[4])
45 pymodule['versionlist'] = (int(setuppy_verinfo_exp[0]), int(setuppy_verinfo_exp[1]), int(
46 setuppy_verinfo_exp[2]), str(setuppy_verinfo_exp[3]), int(setuppy_verinfo_exp[4]))
47 pymodule['verdate'] = str(setuppy_dateinfo_exp[0])+"." + \
48 str(setuppy_dateinfo_exp[1])+"."+str(setuppy_dateinfo_exp[2])
49 pymodule['verdaterc'] = int(setuppy_dateinfo_exp[4])
50 pymodule['verdatelist'] = (int(setuppy_dateinfo_exp[0]), int(setuppy_dateinfo_exp[1]), int(
51 setuppy_dateinfo_exp[2]), str(setuppy_dateinfo_exp[3]), int(setuppy_dateinfo_exp[4]))
52 pymodule['name'] = 'PyOpenCNAM'
53 pymodule['author'] = 'Kazuki Przyborowski'
54 pymodule['authoremail'] = 'kazuki.przyborowski@gmail.com'
55 pymodule['maintainer'] = 'Kazuki Przyborowski'
56 pymodule['maintaineremail'] = 'kazuki.przyborowski@gmail.com'
57 pymodule['description'] = 'Get cnam info from phone numbers from opencnam.'
58 pymodule['license'] = 'Revised BSD License'
59 pymodule['keywords'] = 'opencnam pyopencnam python python-opencnam'
60 pymodule['url'] = 'https://github.com/GameMaker2k/PyOpenCNAM'
61 pymodule['downloadurl'] = 'https://github.com/GameMaker2k/PyOpenCNAM/archive/master.tar.gz'
62 pymodule['longdescription'] = 'Get cnam info from phone numbers from opencnam.'
63 pymodule['platforms'] = 'OS Independent'
64 pymodule['zipsafe'] = True
65 pymodule['pymodules'] = ['pyopencnam']
66 pymodule['classifiers'] = [
67 'Development Status :: 5 - Production/Stable',
68 'Intended Audience :: Developers',
69 'Intended Audience :: Other Audience',
70 'License :: OSI Approved',
71 'License :: OSI Approved :: BSD License',
72 'Natural Language :: English',
73 'Operating System :: MacOS',
74 'Operating System :: MacOS :: MacOS X',
75 'Operating System :: Microsoft',
76 'Operating System :: Microsoft :: Windows',
77 'Operating System :: OS/2',
78 'Operating System :: OS Independent',
79 'Operating System :: POSIX',
80 'Operating System :: Unix',
81 'Programming Language :: Python',
82 'Topic :: Utilities',
83 'Topic :: Software Development',
84 'Topic :: Software Development :: Libraries',
85 'Topic :: Software Development :: Libraries :: Python Modules'
87 if(len(sys.argv) > 1 and (sys.argv[1] == "versioninfo" or sys.argv[1] == "getversioninfo")):
88 import json
89 pymodule_data = json.dumps(pymodule)
90 print(pymodule_data)
91 sys.exit()
92 if(len(sys.argv) > 1 and (sys.argv[1] == "sourceinfo" or sys.argv[1] == "getsourceinfo")):
93 srcinfofilename = os.path.realpath("."+os.path.sep+pkg_resources.to_filename(
94 pymodule['name'])+".egg-info"+os.path.sep+"SOURCES.txt")
95 srcinfofile = open(srcinfofilename, "r")
96 srcinfodata = srcinfofile.read()
97 srcinfofile.close()
98 srcinfolist = srcinfodata.split('\n')
99 srcfilelist = ""
100 srcpdir = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
101 for ifile in srcinfolist:
102 srcfilelist = "."+os.path.sep+srcpdir+os.path.sep+ifile+" "+srcfilelist
103 print(srcfilelist)
104 sys.exit()
105 if(len(sys.argv) > 1 and sys.argv[1] == "cleansourceinfo"):
106 os.system("rm -rfv \""+os.path.realpath("."+os.path.sep+"dist\""))
107 os.system("rm -rfv \""+os.path.realpath("."+os.path.sep +
108 pkg_resources.to_filename(pymodule['name'])+".egg-info\""))
109 sys.exit()
111 setup(
112 name=pymodule['name'],
113 version=pymodule['version'],
114 author=pymodule['author'],
115 author_email=pymodule['authoremail'],
116 maintainer=pymodule['maintainer'],
117 maintainer_email=pymodule['maintaineremail'],
118 description=pymodule['description'],
119 license=pymodule['license'],
120 keywords=pymodule['keywords'],
121 url=pymodule['url'],
122 download_url=pymodule['downloadurl'],
123 long_description=pymodule['longdescription'],
124 platforms=pymodule['platforms'],
125 zip_safe=pymodule['zipsafe'],
126 py_modules=pymodule['pymodules'],
127 classifiers=pymodule['classifiers']