scripts/install.py

branch
eric7
changeset 9347
da982d5b0718
parent 9328
49a0a9cb2505
child 9356
803a7a85b071
equal deleted inserted replaced
9346:eda0bdb22e67 9347:da982d5b0718
262 262
263 text = text.replace("@BINDIR@", platBinDir) 263 text = text.replace("@BINDIR@", platBinDir)
264 text = text.replace("@MARKER@", "") 264 text = text.replace("@MARKER@", "")
265 text = text.replace("@PY_MARKER@", "") 265 text = text.replace("@PY_MARKER@", "")
266 266
267 dstPath = os.path.dirname(dst)
268 if not os.path.isdir(dstPath):
269 os.makedirs(dstPath)
267 with open(dst, "w", encoding="utf-8") as f: 270 with open(dst, "w", encoding="utf-8") as f:
268 f.write(text) 271 f.write(text)
269 os.chmod(dst, 0o644) 272 os.chmod(dst, 0o644)
270 273
271 274
292 text.replace("@MARKER@", "") 295 text.replace("@MARKER@", "")
293 .replace("@VERSION@", Version.split(None, 1)[0]) 296 .replace("@VERSION@", Version.split(None, 1)[0])
294 .replace("@DATE@", time.strftime("%Y-%m-%d")) 297 .replace("@DATE@", time.strftime("%Y-%m-%d"))
295 ) 298 )
296 299
300 dstPath = os.path.dirname(dst)
301 if not os.path.isdir(dstPath):
302 os.makedirs(dstPath)
297 with open(dst, "w", encoding="utf-8") as f: 303 with open(dst, "w", encoding="utf-8") as f:
298 f.write(text) 304 f.write(text)
299 os.chmod(dst, 0o644) 305 os.chmod(dst, 0o644)
300 306
301 307
904 # install the API file 910 # install the API file
905 if installApis: 911 if installApis:
906 for progLanguage in progLanguages: 912 for progLanguage in progLanguages:
907 apidir = os.path.join(cfg["apidir"], progLanguage.lower()) 913 apidir = os.path.join(cfg["apidir"], progLanguage.lower())
908 print("Installing {0} API files to '{1}'.".format(progLanguage, apidir)) 914 print("Installing {0} API files to '{1}'.".format(progLanguage, apidir))
909 if not os.path.exists(apidir): 915 try:
910 os.makedirs(apidir) 916 if not os.path.exists(apidir):
917 os.makedirs(apidir)
918 except OSError:
919 print("Could not create '{0}' (no permission).".format(apidir))
920 continue
911 for apiName in glob.glob( 921 for apiName in glob.glob(
912 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api") 922 os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")
913 ): 923 ):
914 try: 924 try:
915 shutilCopy(apiName, apidir) 925 shutilCopy(apiName, apidir)

eric ide

mercurial