Add files via upload
[PyWWW-Get.git] / setup.py
blobc3fee9d2323ce63e61de6b26a2b403aa48cf2b50
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 2016-2023 Game Maker 2k - https://github.com/GameMaker2k
13 Copyright 2016-2023 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
15 $FileInfo: setup.py - Last Update: 9/24/2023 Ver. 1.5.0 RC 1 - Author: cooldude2k $
16 '''
18 import re, os, sys, time, datetime, platform, pkg_resources;
19 from setuptools import setup, find_packages;
21 verinfofilename = os.path.realpath("."+os.path.sep+os.path.sep+"pywwwget.py");
22 verinfofile = open(verinfofilename, "r");
23 verinfodata = verinfofile.read();
24 verinfofile.close();
25 setuppy_verinfo_esc = re.escape("__version_info__ = (")+"(.*)"+re.escape(");");
26 setuppy_verinfo = re.findall(setuppy_verinfo_esc, verinfodata)[0];
27 setuppy_verinfo_exp = [vergetspt.strip().replace("\"", "") for vergetspt in setuppy_verinfo.split(',')];
28 setuppy_dateinfo_esc = re.escape("__version_date_info__ = (")+"(.*)"+re.escape(");");
29 setuppy_dateinfo = re.findall(setuppy_dateinfo_esc, verinfodata)[0];
30 setuppy_dateinfo_exp = [vergetspt.strip().replace("\"", "") for vergetspt in setuppy_dateinfo.split(',')];
31 pymodule = {};
32 pymodule['version'] = str(setuppy_verinfo_exp[0])+"."+str(setuppy_verinfo_exp[1])+"."+str(setuppy_verinfo_exp[2]);
33 pymodule['versionrc'] = int(setuppy_verinfo_exp[4]);
34 pymodule['versionlist'] = (int(setuppy_verinfo_exp[0]), int(setuppy_verinfo_exp[1]), int(setuppy_verinfo_exp[2]), str(setuppy_verinfo_exp[3]), int(setuppy_verinfo_exp[4]));
35 pymodule['verdate'] = str(setuppy_dateinfo_exp[0])+"."+str(setuppy_dateinfo_exp[1])+"."+str(setuppy_dateinfo_exp[2]);
36 pymodule['verdaterc'] = int(setuppy_dateinfo_exp[4]);
37 pymodule['verdatelist'] = (int(setuppy_dateinfo_exp[0]), int(setuppy_dateinfo_exp[1]), int(setuppy_dateinfo_exp[2]), str(setuppy_dateinfo_exp[3]), int(setuppy_dateinfo_exp[4]));
38 pymodule['name'] = 'PyWWW-Get';
39 pymodule['author'] = 'Kazuki Przyborowski';
40 pymodule['authoremail'] = 'kazuki.przyborowski@gmail.com';
41 pymodule['maintainer'] = 'Kazuki Przyborowski';
42 pymodule['maintaineremail'] = 'kazuki.przyborowski@gmail.com';
43 pymodule['description'] = 'Python libary/module to download files.';
44 pymodule['license'] = 'Revised BSD License';
45 pymodule['keywords'] = 'pywwwget python python-wwwget www wwwget';
46 pymodule['url'] = 'https://github.com/GameMaker2k/PyWWW-Get';
47 pymodule['downloadurl'] = 'https://github.com/GameMaker2k/PyWWW-Get/archive/master.tar.gz';
48 pymodule['longdescription'] = 'Python libary/module to download files.';
49 pymodule['platforms'] = 'OS Independent';
50 pymodule['zipsafe'] = True;
51 pymodule['pymodules'] = ['pywwwget', 'pywwwgetold'];
52 pymodule['scripts'] = ['pywwwget-dl.py', 'pywwwgetold-dl.py', 'pyhttpserv.py'];
53 pymodule['classifiers'] = [
54 'Development Status :: 5 - Production/Stable',
55 'Intended Audience :: Developers',
56 'Intended Audience :: Other Audience',
57 'License :: OSI Approved',
58 'License :: OSI Approved :: BSD License',
59 'Natural Language :: English',
60 'Operating System :: MacOS',
61 'Operating System :: MacOS :: MacOS X',
62 'Operating System :: Microsoft',
63 'Operating System :: Microsoft :: Windows',
64 'Operating System :: OS/2',
65 'Operating System :: OS Independent',
66 'Operating System :: POSIX',
67 'Operating System :: Unix',
68 'Programming Language :: Python',
69 'Topic :: Utilities',
70 'Topic :: Software Development',
71 'Topic :: Software Development :: Libraries',
72 'Topic :: Software Development :: Libraries :: Python Modules'
74 if(len(sys.argv)>1 and (sys.argv[1]=="versioninfo" or sys.argv[1]=="getversioninfo")):
75 import json;
76 pymodule_data = json.dumps(pymodule);
77 print(pymodule_data);
78 sys.exit();
79 if(len(sys.argv)>1 and (sys.argv[1]=="sourceinfo" or sys.argv[1]=="getsourceinfo")):
80 srcinfofilename = os.path.realpath("."+os.path.sep+pkg_resources.to_filename(pymodule['name'])+".egg-info"+os.path.sep+"SOURCES.txt");
81 srcinfofile = open(srcinfofilename, "r");
82 srcinfodata = srcinfofile.read();
83 srcinfofile.close();
84 srcinfolist = srcinfodata.split('\n');
85 srcfilelist = "";
86 srcpdir = os.path.basename(os.path.dirname(os.path.realpath(__file__)));
87 for ifile in srcinfolist:
88 srcfilelist = "."+os.path.sep+srcpdir+os.path.sep+ifile+" "+srcfilelist;
89 print(srcfilelist);
90 sys.exit();
91 if(len(sys.argv)>1 and sys.argv[1]=="cleansourceinfo"):
92 os.system("rm -rfv \""+os.path.realpath("."+os.path.sep+"dist\""));
93 os.system("rm -rfv \""+os.path.realpath("."+os.path.sep+pkg_resources.to_filename(pymodule['name'])+".egg-info\""));
94 sys.exit();
96 setup(
97 name = pymodule['name'],
98 version = pymodule['version'],
99 author = pymodule['author'],
100 author_email = pymodule['authoremail'],
101 maintainer = pymodule['maintainer'],
102 maintainer_email = pymodule['maintaineremail'],
103 description = pymodule['description'],
104 license = pymodule['license'],
105 keywords = pymodule['keywords'],
106 url = pymodule['url'],
107 download_url = pymodule['downloadurl'],
108 long_description = pymodule['longdescription'],
109 platforms = pymodule['platforms'],
110 zip_safe = pymodule['zipsafe'],
111 py_modules = pymodule['pymodules'],
112 scripts = pymodule['scripts'],
113 classifiers = pymodule['classifiers']