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