setup.py

branch
maintenance
changeset 7824
096b3ebc1409
parent 7809
f5a61d073100
child 7836
2f0d208b8137
--- a/setup.py	Sat Oct 03 11:14:23 2020 +0200
+++ b/setup.py	Sun Nov 01 11:15:18 2020 +0100
@@ -8,16 +8,18 @@
 Module to prepare a distribution package for uploading to PyPI.
 """
 
-
 import os
 import sys
 import subprocess                   # secok
 import shutil
 import fnmatch
 import datetime
+import json
 
 from setuptools import setup, find_packages
 
+installInfoName = "eric6installpip.json"
+
 ######################################################################
 ## some helper functions below
 ######################################################################
@@ -146,16 +148,14 @@
         hgOut = hgOut.strip()
         if hgOut.endswith("+"):
             hgOut = hgOut[:-1]
-        f = open(fileName + ".orig", "r", encoding="utf-8")
-        text = f.read()
-        f.close()
+        with open(fileName + ".orig", "r", encoding="utf-8") as f:
+            text = f.read()
         text = (
             text.replace("@@REVISION@@", hgOut)
             .replace("@@VERSION@@", version)
         )
-        f = open(fileName, "w")
-        f.write(text)
-        f.close()
+        with open(fileName, "w") as f:
+            f.write(text)
     else:
         shutil.copy(fileName + ".orig", fileName)
 
@@ -174,16 +174,14 @@
         os.rename(fileName, fileName + ".orig")
     except EnvironmentError:
         pass
-    f = open(fileName + ".orig", "r", encoding="utf-8")
-    text = f.read()
-    f.close()
+    with open(fileName + ".orig", "r", encoding="utf-8") as f:
+        text = f.read()
     text = (
         text.replace("@VERSION@", version)
         .replace("@DATE@", datetime.date.today().isoformat())
     )
-    f = open(fileName, "w")
-    f.write(text)
-    f.close()
+    with open(fileName, "w") as f:
+        f.write(text)
 
 
 def cleanupSource(dirName):
@@ -246,6 +244,38 @@
     from PyQt5.uic import compileUiDir
     compileUiDir(dirName, True, __pyName)
 
+
+def createInstallInfoFile(dirName):
+    """
+    Create a file containing some rudimentary install information.
+    
+    @param dirName name of the directory to compile UI files for
+    @type str
+    """
+    global installInfoName
+    
+    installInfo = {
+        "sudo": False,
+        "user": "",
+        "exe": "",
+        "argv": "",
+        "install_cwd": "",
+        "eric": "",
+        "virtualenv": False,
+        "installed": False,
+        "installed_on": "",
+        "guessed": False,
+        "edited": False,
+        "pip": True,
+        "remarks": "",
+        "install_cwd_edited": False,
+        "exe_edited": False,
+        "argv_edited": False,
+        "eric_edited": False,
+    }
+    with open(os.path.join(dirName, installInfoName), "w") as infoFile:
+        json.dump(installInfo, infoFile, indent=2)
+
 ######################################################################
 ## setup() below
 ######################################################################
@@ -262,6 +292,7 @@
     compileUiFiles(sourceDir)
     prepareInfoFile(infoFileName, Version)
     prepareAppdataFile(appdataFileName, Version)
+    createInstallInfoFile(sourceDir)
     print("Preparation finished")           # __IGNORE_WARNING_M801__
 
 setup(
@@ -300,6 +331,7 @@
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
         "Topic :: Software Development",
         "Topic :: Text Editors :: Integrated Development Environments (IDE)"
     ],
@@ -327,6 +359,7 @@
              ".bas", ".dat", ".xbel", ".xml", ".js"]
         ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm",
              "i18n/eric6_ru.qm",
+             installInfoName,
              ]
     },
     entry_points={
@@ -342,7 +375,6 @@
             "eric6_plugininstall = eric6.eric6_plugininstall:main",
             "eric6_pluginrepository = eric6.eric6_pluginrepository:main",
             "eric6_pluginuninstall = eric6.eric6_pluginuninstall:main",
-            "eric6_qregexp = eric6.eric6_qregexp:main",
             "eric6_qregularexpression = eric6.eric6_qregularexpression:main",
             "eric6_re = eric6.eric6_re:main",
             "eric6_shell = eric6.eric6_shell:main",

eric ide

mercurial