setup.py

branch
maintenance
changeset 7286
7eb04391adf7
parent 7257
c4d0cac9b5c9
child 7360
9190402e4505
equal deleted inserted replaced
7226:babe80d84a3e 7286:7eb04391adf7
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 10
11 from __future__ import unicode_literals
12 11
13 import os 12 import os
14 import sys 13 import sys
15 import subprocess 14 import subprocess
16 import shutil 15 import shutil
55 @rtype list of str 54 @rtype list of str
56 """ 55 """
57 filesList = [] 56 filesList = []
58 for dirpath, _dirnames, filenames in os.walk(package): 57 for dirpath, _dirnames, filenames in os.walk(package):
59 for fname in filenames: 58 for fname in filenames:
60 if not fname.startswith('.') and \ 59 if (
61 os.path.splitext(fname)[1] in extensions: 60 not fname.startswith('.') and
61 os.path.splitext(fname)[1] in extensions
62 ):
62 filesList.append( 63 filesList.append(
63 os.path.relpath(os.path.join(dirpath, fname), package)) 64 os.path.relpath(os.path.join(dirpath, fname), package))
64 return filesList 65 return filesList
65 66
66 67
135 os.rename(fileName, fileName + ".orig") 136 os.rename(fileName, fileName + ".orig")
136 except EnvironmentError: 137 except EnvironmentError:
137 pass 138 pass
138 try: 139 try:
139 hgOut = subprocess.check_output(["hg", "identify", "-i"]) 140 hgOut = subprocess.check_output(["hg", "identify", "-i"])
140 if sys.version_info[0] == 3: 141 hgOut = hgOut.decode()
141 hgOut = hgOut.decode()
142 except (OSError, subprocess.CalledProcessError): 142 except (OSError, subprocess.CalledProcessError):
143 hgOut = "" 143 hgOut = ""
144 if hgOut: 144 if hgOut:
145 hgOut = hgOut.strip() 145 hgOut = hgOut.strip()
146 if hgOut.endswith("+"): 146 if hgOut.endswith("+"):
147 hgOut = hgOut[:-1] 147 hgOut = hgOut[:-1]
148 f = open(fileName + ".orig", "r", encoding="utf-8") 148 f = open(fileName + ".orig", "r", encoding="utf-8")
149 text = f.read() 149 text = f.read()
150 f.close() 150 f.close()
151 text = text.replace("@@REVISION@@", hgOut)\ 151 text = (
152 text.replace("@@REVISION@@", hgOut)
152 .replace("@@VERSION@@", version) 153 .replace("@@VERSION@@", version)
154 )
153 f = open(fileName, "w") 155 f = open(fileName, "w")
154 f.write(text) 156 f.write(text)
155 f.close() 157 f.close()
156 else: 158 else:
157 shutil.copy(fileName + ".orig", fileName) 159 shutil.copy(fileName + ".orig", fileName)
172 except EnvironmentError: 174 except EnvironmentError:
173 pass 175 pass
174 f = open(fileName + ".orig", "r", encoding="utf-8") 176 f = open(fileName + ".orig", "r", encoding="utf-8")
175 text = f.read() 177 text = f.read()
176 f.close() 178 f.close()
177 text = text.replace("@VERSION@", version)\ 179 text = (
180 text.replace("@VERSION@", version)
178 .replace("@DATE@", datetime.date.today().isoformat()) 181 .replace("@DATE@", datetime.date.today().isoformat())
182 )
179 f = open(fileName, "w") 183 f = open(fileName, "w")
180 f.write(text) 184 f.write(text)
181 f.close() 185 f.close()
182 186
183 187
314 zip_safe=False, 318 zip_safe=False,
315 package_data={ 319 package_data={
316 "": getPackageData( 320 "": getPackageData(
317 "eric6", 321 "eric6",
318 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt", 322 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt",
319 ".style", ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", 323 ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api",
320 ".e6h", ".api", ".bas" ".dat"] 324 ".bas" ".dat"]
321 ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm", 325 ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm",
322 "i18n/eric6_ru.qm", 326 "i18n/eric6_ru.qm",
323 ] 327 ]
324 }, 328 },
325 entry_points={ 329 entry_points={

eric ide

mercurial