Sun, 26 Apr 2015 14:26:44 +0200
Changed the install script to include the Mercurial revision number when install from the sources.
--- a/APIs/Python3/eric6.api Fri Apr 24 18:41:06 2015 +0200 +++ b/APIs/Python3/eric6.api Sun Apr 26 14:26:44 2015 +0200 @@ -9200,6 +9200,7 @@ eric6.install.main?4(argv) eric6.install.modDir?7 eric6.install.platBinDir?7 +eric6.install.prepareInfoFile?4(fileName) eric6.install.progLanguages?7 eric6.install.progName?7 eric6.install.pyModDir?7
--- a/Documentation/Help/source.qhp Fri Apr 24 18:41:06 2015 +0200 +++ b/Documentation/Help/source.qhp Sun Apr 26 14:26:44 2015 +0200 @@ -13518,6 +13518,7 @@ <keyword name="pbkdf2" id="pbkdf2" ref="eric6.Utilities.crypto.py3PBKDF2.html#pbkdf2" /> <keyword name="pendingWrite" id="pendingWrite" ref="eric6.DebugClients.Ruby.AsyncFile.html#pendingWrite" /> <keyword name="pep8 (Module)" id="pep8 (Module)" ref="eric6.Plugins.CheckerPlugins.CodeStyleChecker.pep8.html" /> + <keyword name="prepareInfoFile" id="prepareInfoFile" ref="eric6.install.html#prepareInfoFile" /> <keyword name="prepareProcess" id="prepareProcess" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgUtilities.html#prepareProcess" /> <keyword name="prepareQtMacBundle" id="prepareQtMacBundle" ref="eric6.Utilities.__init__.html#prepareQtMacBundle" /> <keyword name="prepareUninstall" id="prepareUninstall" ref="eric6.Plugins.PluginVcsMercurial.html#prepareUninstall" />
--- a/Documentation/Source/eric6.install.html Fri Apr 24 18:41:06 2015 +0200 +++ b/Documentation/Source/eric6.install.html Sun Apr 26 14:26:44 2015 +0200 @@ -91,6 +91,9 @@ <td><a href="#main">main</a></td> <td>The main function of the script.</td> </tr><tr> +<td><a href="#prepareInfoFile">prepareInfoFile</a></td> +<td>Function to prepare an Info.py file when installing from source.</td> +</tr><tr> <td><a href="#pyName">pyName</a></td> <td>Local function to create the Python source file name for the compiled .ui file.</td> </tr><tr> @@ -376,6 +379,19 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="prepareInfoFile" ID="prepareInfoFile"></a> +<h2>prepareInfoFile</h2> +<b>prepareInfoFile</b>(<i>fileName</i>) +<p> + Function to prepare an Info.py file when installing from source. +</p><dl> +<dt><i>fileName</i></dt> +<dd> +name of the Python file containing the info (string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="pyName" ID="pyName"></a> <h2>pyName</h2> <b>pyName</b>(<i>py_dir, py_file</i>)
--- a/install.py Fri Apr 24 18:41:06 2015 +0200 +++ b/install.py Sun Apr 26 14:26:44 2015 +0200 @@ -30,6 +30,7 @@ import fnmatch import distutils.sysconfig import codecs +import subprocess # Define the globals. progName = None @@ -1313,6 +1314,38 @@ compileUiDir(sourceDir, True, pyName) +def prepareInfoFile(fileName): + """ + Function to prepare an Info.py file when installing from source. + + @param fileName name of the Python file containing the info (string) + """ + if not fileName: + return + + os.rename(fileName, fileName + ".orig") + try: + hgOut = subprocess.check_output(["hg", "identify"]) + if sys.version_info[0] == 3: + hgOut = hgOut.decode() + except (FileNotFoundError, subprocess.CalledProcessError): + hgOut = "" + if hgOut: + hgOut = hgOut.strip().split()[0] + if hgOut.endswith("+"): + hgOut = hgOut[:-1] + if sys.version_info[0] == 2: + f = codecs.open(fileName + ".orig", "r", "utf-8") + else: + f = open(fileName + ".orig", "r", encoding="utf-8") + text = f.read() + f.close() + text = text.replace("@@REVISION@@", hgOut) + copyToFile(fileName, text) + else: + shutil.copy(fileName + ".orig", fileName) + + def main(argv): """ The main function of the script. @@ -1401,10 +1434,15 @@ elif "--noapis": installApis = False + infoName = "" installFromSource = not os.path.isdir(sourceDir) if installFromSource: sourceDir = os.path.dirname(__file__) or "." configName = os.path.join(sourceDir, "eric6config.py") + if os.path.exists(os.path.join(sourceDir, ".hg")): + # we are installing from source with repo + infoName = os.path.join(sourceDir, "UI", "Info.py") + prepareInfoFile(infoName) if len(cfg) == 0: createInstallConfig() @@ -1489,6 +1527,15 @@ os.rename(configName + ".orig", configName) except EnvironmentError: pass + try: + if installFromSource and infoName: + os.remove(infoName) + infoNameC = infoName + 'c' + if os.path.exists(infoNameC): + os.remove(infoNameC) + os.rename(infoName + ".orig", infoName) + except EnvironmentError: + pass print("\nInstallation complete.") print()