setup.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8258
82b608e352ec
child 8275
2f4b8212a151
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
13 import subprocess # secok 13 import subprocess # secok
14 import shutil 14 import shutil
15 import fnmatch 15 import fnmatch
16 import datetime 16 import datetime
17 import json 17 import json
18 import contextlib
18 19
19 from setuptools import setup, find_packages 20 from setuptools import setup, find_packages
20 21
21 installInfoName = "eric6installpip.json" 22 installInfoName = "eric6installpip.json"
22 23
133 @param version version string for the package (string) 134 @param version version string for the package (string)
134 """ 135 """
135 if not fileName: 136 if not fileName:
136 return 137 return
137 138
138 try: 139 with contextlib.suppress(OSError):
139 os.rename(fileName, fileName + ".orig") 140 os.rename(fileName, fileName + ".orig")
140 except OSError:
141 pass
142 try: 141 try:
143 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok 142 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok
144 hgOut = hgOut.decode() 143 hgOut = hgOut.decode()
145 except (OSError, subprocess.CalledProcessError): 144 except (OSError, subprocess.CalledProcessError):
146 hgOut = "" 145 hgOut = ""
168 @param version version string for the package (string) 167 @param version version string for the package (string)
169 """ 168 """
170 if not fileName: 169 if not fileName:
171 return 170 return
172 171
173 try: 172 with contextlib.suppress(OSError):
174 os.rename(fileName, fileName + ".orig") 173 os.rename(fileName, fileName + ".orig")
175 except OSError:
176 pass
177 with open(fileName + ".orig", "r", encoding="utf-8") as f: 174 with open(fileName + ".orig", "r", encoding="utf-8") as f:
178 text = f.read() 175 text = f.read()
179 text = ( 176 text = (
180 text.replace("@VERSION@", version) 177 text.replace("@VERSION@", version)
181 .replace("@DATE@", datetime.date.today().isoformat()) 178 .replace("@DATE@", datetime.date.today().isoformat())
346 "QScintilla>=2.11.1", 343 "QScintilla>=2.11.1",
347 "docutils", 344 "docutils",
348 "Markdown", 345 "Markdown",
349 "pyyaml", 346 "pyyaml",
350 "toml", 347 "toml",
348 "chardet",
349 "asttokens",
350 "EditorConfig",
351 "Send2Trash",
352 "Pygments",
351 "pywin32>=1.0;platform_system=='Windows'", 353 "pywin32>=1.0;platform_system=='Windows'",
352 ], 354 ],
353 data_files=getDataFiles(), 355 data_files=getDataFiles(),
354 packages=find_packages(), 356 packages=find_packages(),
355 zip_safe=False, 357 zip_safe=False,
396 ) 398 )
397 399
398 # cleanup 400 # cleanup
399 for fileName in [infoFileName, appdataFileName]: 401 for fileName in [infoFileName, appdataFileName]:
400 if os.path.exists(fileName + ".orig"): 402 if os.path.exists(fileName + ".orig"):
401 try: 403 with contextlib.suppress(OSError):
402 os.remove(fileName) 404 os.remove(fileName)
403 os.rename(fileName + ".orig", fileName) 405 os.rename(fileName + ".orig", fileName)
404 except OSError:
405 pass

eric ide

mercurial