|
22 | 22 | import shutil |
23 | 23 | import datetime |
24 | 24 | import platform |
25 | | -import pkg_resources |
26 | 25 | from setuptools import setup, find_packages |
27 | 26 |
|
28 | 27 | # Open and read the version info file in a Python 2/3 compatible way |
|
110 | 109 | print(pymodule_data) |
111 | 110 | sys.exit() |
112 | 111 | if(len(sys.argv) > 1 and (sys.argv[1] == "sourceinfo" or sys.argv[1] == "getsourceinfo")): |
113 | | - srcinfofilename = os.path.realpath("."+os.path.sep+pkg_resources.to_filename( |
114 | | - pymodule['name'])+".egg-info"+os.path.sep+"SOURCES.txt") |
| 112 | + srcinfofilename = os.path.realpath("."+os.path.sep+ |
| 113 | + pymodule['name'].replace('-', '_')+".egg-info"+os.path.sep+"SOURCES.txt") |
115 | 114 | srcinfofile = open(srcinfofilename, "r") |
116 | 115 | srcinfodata = srcinfofile.read() |
117 | 116 | srcinfofile.close() |
|
125 | 124 | if(len(sys.argv) > 1 and sys.argv[1] == "cleansourceinfo"): |
126 | 125 | os.system("rm -rfv \""+os.path.realpath("."+os.path.sep+"dist\"")) |
127 | 126 | os.system("rm -rfv \""+os.path.realpath("."+os.path.sep + |
128 | | - pkg_resources.to_filename(pymodule['name'])+".egg-info\"")) |
| 127 | + pymodule['name'].replace('-', '_')+".egg-info\"")) |
| 128 | + sys.exit() |
| 129 | + |
| 130 | +if(len(sys.argv) > 1 and (sys.argv[1] == "buildcfg" or sys.argv[1] == "makecfg")): |
| 131 | + outcfgvar = """[project] |
| 132 | + name = "{}" |
| 133 | + version = "{}" |
| 134 | + readme = "README.md" |
| 135 | + license = {{ text = "BSD-3-Clause" }} |
| 136 | + keywords = [] |
| 137 | + description = "{}" |
| 138 | + authors = [ |
| 139 | + {{ name = "{}", email = "{}" }}, |
| 140 | + ] |
| 141 | + """.format(pymodule['name'], pymodule['version'], pymodule['description'], pymodule['author'], pymodule['authoremail']) |
| 142 | + mytoml = open("./pyproject.toml", "w") |
| 143 | + mytoml.write(outcfgvar) |
| 144 | + mytoml.flush() |
| 145 | + if(hasattr(os, "sync")): |
| 146 | + os.fsync(mytoml.fileno()) |
| 147 | + mytoml.close() |
129 | 148 | sys.exit() |
130 | 149 |
|
131 | 150 | setup( |
|
0 commit comments