5 # |
5 # |
6 |
6 |
7 """ |
7 """ |
8 Module to prepare a distribution package for uploading to PyPI. |
8 Module to prepare a distribution package for uploading to PyPI. |
9 """ |
9 """ |
10 |
|
11 |
10 |
12 import os |
11 import os |
13 import sys |
12 import sys |
14 import subprocess # secok |
13 import subprocess # secok |
15 import shutil |
14 import shutil |
16 import fnmatch |
15 import fnmatch |
17 import datetime |
16 import datetime |
|
17 import json |
18 |
18 |
19 from setuptools import setup, find_packages |
19 from setuptools import setup, find_packages |
|
20 |
|
21 installInfoName = "eric6installpip.json" |
20 |
22 |
21 ###################################################################### |
23 ###################################################################### |
22 ## some helper functions below |
24 ## some helper functions below |
23 ###################################################################### |
25 ###################################################################### |
24 |
26 |
144 hgOut = "" |
146 hgOut = "" |
145 if hgOut: |
147 if hgOut: |
146 hgOut = hgOut.strip() |
148 hgOut = hgOut.strip() |
147 if hgOut.endswith("+"): |
149 if hgOut.endswith("+"): |
148 hgOut = hgOut[:-1] |
150 hgOut = hgOut[:-1] |
149 f = open(fileName + ".orig", "r", encoding="utf-8") |
151 with open(fileName + ".orig", "r", encoding="utf-8") as f: |
150 text = f.read() |
152 text = f.read() |
151 f.close() |
|
152 text = ( |
153 text = ( |
153 text.replace("@@REVISION@@", hgOut) |
154 text.replace("@@REVISION@@", hgOut) |
154 .replace("@@VERSION@@", version) |
155 .replace("@@VERSION@@", version) |
155 ) |
156 ) |
156 f = open(fileName, "w") |
157 with open(fileName, "w") as f: |
157 f.write(text) |
158 f.write(text) |
158 f.close() |
|
159 else: |
159 else: |
160 shutil.copy(fileName + ".orig", fileName) |
160 shutil.copy(fileName + ".orig", fileName) |
161 |
161 |
162 |
162 |
163 def prepareAppdataFile(fileName, version): |
163 def prepareAppdataFile(fileName, version): |
172 |
172 |
173 try: |
173 try: |
174 os.rename(fileName, fileName + ".orig") |
174 os.rename(fileName, fileName + ".orig") |
175 except EnvironmentError: |
175 except EnvironmentError: |
176 pass |
176 pass |
177 f = open(fileName + ".orig", "r", encoding="utf-8") |
177 with open(fileName + ".orig", "r", encoding="utf-8") as f: |
178 text = f.read() |
178 text = f.read() |
179 f.close() |
|
180 text = ( |
179 text = ( |
181 text.replace("@VERSION@", version) |
180 text.replace("@VERSION@", version) |
182 .replace("@DATE@", datetime.date.today().isoformat()) |
181 .replace("@DATE@", datetime.date.today().isoformat()) |
183 ) |
182 ) |
184 f = open(fileName, "w") |
183 with open(fileName, "w") as f: |
185 f.write(text) |
184 f.write(text) |
186 f.close() |
|
187 |
185 |
188 |
186 |
189 def cleanupSource(dirName): |
187 def cleanupSource(dirName): |
190 """ |
188 """ |
191 Cleanup the sources directory to get rid of leftover files |
189 Cleanup the sources directory to get rid of leftover files |
243 |
241 |
244 @param dirName name of the directory to compile UI files for (string) |
242 @param dirName name of the directory to compile UI files for (string) |
245 """ |
243 """ |
246 from PyQt5.uic import compileUiDir |
244 from PyQt5.uic import compileUiDir |
247 compileUiDir(dirName, True, __pyName) |
245 compileUiDir(dirName, True, __pyName) |
|
246 |
|
247 |
|
248 def createInstallInfoFile(dirName): |
|
249 """ |
|
250 Create a file containing some rudimentary install information. |
|
251 |
|
252 @param dirName name of the directory to compile UI files for |
|
253 @type str |
|
254 """ |
|
255 global installInfoName |
|
256 |
|
257 installInfo = { |
|
258 "sudo": False, |
|
259 "user": "", |
|
260 "exe": "", |
|
261 "argv": "", |
|
262 "install_cwd": "", |
|
263 "eric": "", |
|
264 "virtualenv": False, |
|
265 "installed": False, |
|
266 "installed_on": "", |
|
267 "guessed": False, |
|
268 "edited": False, |
|
269 "pip": True, |
|
270 "remarks": "", |
|
271 "install_cwd_edited": False, |
|
272 "exe_edited": False, |
|
273 "argv_edited": False, |
|
274 "eric_edited": False, |
|
275 } |
|
276 with open(os.path.join(dirName, installInfoName), "w") as infoFile: |
|
277 json.dump(installInfo, infoFile, indent=2) |
248 |
278 |
249 ###################################################################### |
279 ###################################################################### |
250 ## setup() below |
280 ## setup() below |
251 ###################################################################### |
281 ###################################################################### |
252 |
282 |
260 print("preparing the sources...") # __IGNORE_WARNING_M801__ |
290 print("preparing the sources...") # __IGNORE_WARNING_M801__ |
261 cleanupSource(sourceDir) |
291 cleanupSource(sourceDir) |
262 compileUiFiles(sourceDir) |
292 compileUiFiles(sourceDir) |
263 prepareInfoFile(infoFileName, Version) |
293 prepareInfoFile(infoFileName, Version) |
264 prepareAppdataFile(appdataFileName, Version) |
294 prepareAppdataFile(appdataFileName, Version) |
|
295 createInstallInfoFile(sourceDir) |
265 print("Preparation finished") # __IGNORE_WARNING_M801__ |
296 print("Preparation finished") # __IGNORE_WARNING_M801__ |
266 |
297 |
267 setup( |
298 setup( |
268 name="eric-ide", |
299 name="eric-ide", |
269 version=Version, |
300 version=Version, |
298 "Programming Language :: Python", |
329 "Programming Language :: Python", |
299 "Programming Language :: Python :: 3.5", |
330 "Programming Language :: Python :: 3.5", |
300 "Programming Language :: Python :: 3.6", |
331 "Programming Language :: Python :: 3.6", |
301 "Programming Language :: Python :: 3.7", |
332 "Programming Language :: Python :: 3.7", |
302 "Programming Language :: Python :: 3.8", |
333 "Programming Language :: Python :: 3.8", |
|
334 "Programming Language :: Python :: 3.9", |
303 "Topic :: Software Development", |
335 "Topic :: Software Development", |
304 "Topic :: Text Editors :: Integrated Development Environments (IDE)" |
336 "Topic :: Text Editors :: Integrated Development Environments (IDE)" |
305 ], |
337 ], |
306 keywords="Development PyQt5 IDE Python3", |
338 keywords="Development PyQt5 IDE Python3", |
307 python_requires=">=3.5", |
339 python_requires=">=3.5", |
325 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt", |
357 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt", |
326 ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api", |
358 ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api", |
327 ".bas", ".dat", ".xbel", ".xml", ".js"] |
359 ".bas", ".dat", ".xbel", ".xml", ".js"] |
328 ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm", |
360 ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm", |
329 "i18n/eric6_ru.qm", |
361 "i18n/eric6_ru.qm", |
|
362 installInfoName, |
330 ] |
363 ] |
331 }, |
364 }, |
332 entry_points={ |
365 entry_points={ |
333 "gui_scripts": [ |
366 "gui_scripts": [ |
334 "eric6 = eric6.eric6:main", |
367 "eric6 = eric6.eric6:main", |
340 "eric6_hexeditor = eric6.eric6_hexeditor:main", |
373 "eric6_hexeditor = eric6.eric6_hexeditor:main", |
341 "eric6_iconeditor = eric6.eric6_iconeditor:main", |
374 "eric6_iconeditor = eric6.eric6_iconeditor:main", |
342 "eric6_plugininstall = eric6.eric6_plugininstall:main", |
375 "eric6_plugininstall = eric6.eric6_plugininstall:main", |
343 "eric6_pluginrepository = eric6.eric6_pluginrepository:main", |
376 "eric6_pluginrepository = eric6.eric6_pluginrepository:main", |
344 "eric6_pluginuninstall = eric6.eric6_pluginuninstall:main", |
377 "eric6_pluginuninstall = eric6.eric6_pluginuninstall:main", |
345 "eric6_qregexp = eric6.eric6_qregexp:main", |
|
346 "eric6_qregularexpression = eric6.eric6_qregularexpression:main", |
378 "eric6_qregularexpression = eric6.eric6_qregularexpression:main", |
347 "eric6_re = eric6.eric6_re:main", |
379 "eric6_re = eric6.eric6_re:main", |
348 "eric6_shell = eric6.eric6_shell:main", |
380 "eric6_shell = eric6.eric6_shell:main", |
349 "eric6_snap = eric6.eric6_snap:main", |
381 "eric6_snap = eric6.eric6_snap:main", |
350 "eric6_sqlbrowser = eric6.eric6_sqlbrowser:main", |
382 "eric6_sqlbrowser = eric6.eric6_sqlbrowser:main", |