aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-20 15:50:57 +0000
committermarha <marha@users.sourceforge.net>2011-01-20 15:50:57 +0000
commit26ee05a8febfe1ed6da852777a8c1c2a37e4cf9b (patch)
treeb7a5b98224f0aeb4ba9071f6effa41f0281910f7 /tools
parentc7f5c2bc1637b96afe8e52b6700de659c1ea4a36 (diff)
downloadvcxsrv-26ee05a8febfe1ed6da852777a8c1c2a37e4cf9b.tar.gz
vcxsrv-26ee05a8febfe1ed6da852777a8c1c2a37e4cf9b.tar.bz2
vcxsrv-26ee05a8febfe1ed6da852777a8c1c2a37e4cf9b.zip
Removed py2exe
Diffstat (limited to 'tools')
-rw-r--r--tools/mhmake/src/build.cpp277
-rw-r--r--tools/mhmake/src/mhmakefileparser.h1
-rw-r--r--tools/mhmake/src/util.h2
3 files changed, 1 insertions, 279 deletions
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp
index 185fdb2fb..6d3c4afda 100644
--- a/tools/mhmake/src/build.cpp
+++ b/tools/mhmake/src/build.cpp
@@ -24,220 +24,6 @@
#include "rule.h"
#include "util.h"
-/* Calling py2exe is only implemented on windows for now. */
-#ifdef WIN32
-
-/* Python exe create script in parts:
-import zipfile,tempfile,shutil,os
-
-def UpdateZipFile(SrcZip,DestZip):
- NewZip=tempfile.mktemp('.zip')
-
- Src=zipfile.ZipFile(SrcZip)
-
- New=zipfile.ZipFile(NewZip,'w')
-
- InFile={}
- for name in Src.namelist():
- InFile[name]=1
- New.writestr(name,Src.read(name))
- Src.close()
-
- try:
- Dest=zipfile.ZipFile(DestZip)
-
- for name in Dest.namelist():
- if not InFile.has_key(name):
- New.writestr(name,Dest.read(name))
- Dest.close()
- except IOError:
- pass
- New.close()
-
- shutil.move(NewZip,DestZip)
-
-OutFileName=tempfile.mktemp('.py')
-pOut=open(OutFileName,'w')
-
-Script=r'<PYTHONSCRIPT>'
-DirScript=os.path.split(Script)[0]
-pOut.write(r'''
-
-from distutils.core import setup
-import py2exe
-import sys
-sys.path.append(r'%s')
-setup(zipfile=None, console=[r'%s'])
-'''%(DirScript,Script))
-
-pOut.close()
-
-import os
-
-stdin,stdout=os.popen4(r'"<PYTHONEXE>" %s py2exe'%OutFileName);
-stdout.read()
-stdout.close()
-stdin.close()
-
-OutDir=os.path.split(Script)[0]
-
-import shutil
-def CopyFiles(Src,Dest):
- for File in os.listdir(Src):
- SrcDir=os.path.join(Src,File)
- if File=='library.zip':
- UpdateZipFile(os.path.join(Src,File),os.path.join(Dest,File))
- elif os.path.isdir(SrcDir):
- DestDir=os.path.join(Dest,File)
- os.mkdir(DestDir)
- CopyFiles(SrcDir,DestDir)
- else:
- shutil.copy(os.path.join(Src,File),os.path.join(Dest,File))
-
-if os.path.isdir('dist'):
- CopyFiles('dist',OutDir)
-
- try:
- shutil.rmtree('dist')
- except:
- pass
- try:
- shutil.rmtree('build')
- except:
- pass
-os.remove(OutFileName)
-*/
-
-static const string PythonScriptPart1=
-"import zipfile,tempfile,shutil,os\n"
-"\n"
-"def UpdateZipFile(SrcZip,DestZip):\n"
-" NewZip=tempfile.mktemp('.zip')\n"
-"\n"
-" Src=zipfile.ZipFile(SrcZip)\n"
-"\n"
-" New=zipfile.ZipFile(NewZip,'w')\n"
-"\n"
-" InFile={}\n"
-" for name in Src.namelist():\n"
-" InFile[name]=1\n"
-" New.writestr(name,Src.read(name))\n"
-" Src.close()\n"
-"\n"
-" try:\n"
-" Dest=zipfile.ZipFile(DestZip)\n"
-"\n"
-" for name in Dest.namelist():\n"
-" if not InFile.has_key(name):\n"
-" New.writestr(name,Dest.read(name))\n"
-" Dest.close()\n"
-" except IOError:\n"
-" pass\n"
-" New.close()\n"
-"\n"
-" shutil.move(NewZip,DestZip)\n"
-"\n"
-"OutFileName=tempfile.mktemp('.py')\n"
-"pOut=open(OutFileName,'w')\n"
-"\n"
-"Script=r'"
-;
-
-static const string PythonScriptPart2=
-"'\n"
-"DirScript=os.path.split(Script)[0]\n"
-"\n"
-"pOut.write(r'''\n"
-"\n"
-"from distutils.core import setup\n"
-"import py2exe\n"
-"import sys\n"
-"sys.path.append(r'%s')\n"
-"setup(console=[r'%s'])\n"
-"'''%(DirScript,Script))\n"
-"\n"
-"pOut.close()\n"
-"\n"
-"import os\n"
-"\n"
-"stdin,stdout=os.popen4(r'"
-;
-
-static const string PythonScriptPart3=
-"%s py2exe'%OutFileName);\n"
-"stdout.read()\n"
-"stdout.close()\n"
-"stdin.close()\n"
-"\n"
-"OutDir=os.path.split(Script)[0]\n"
-"\n"
-"import shutil\n"
-"def CopyFiles(Src,Dest):\n"
-" for File in os.listdir(Src):\n"
-" SrcDir=os.path.join(Src,File)\n"
-" if File=='library.zip':\n"
-" UpdateZipFile(os.path.join(Src,File),os.path.join(Dest,File))\n"
-" elif os.path.isdir(SrcDir):\n"
-" DestDir=os.path.join(Dest,File)\n"
-" os.mkdir(DestDir)\n"
-" CopyFiles(SrcDir,DestDir)\n"
-" else:\n"
-" shutil.copy(os.path.join(Src,File),os.path.join(Dest,File))\n"
-"\n"
-"if os.path.isdir('dist'):\n"
-" CopyFiles('dist',OutDir)\n"
-"\n"
-" try:\n"
-" shutil.rmtree('dist')\n"
-" except:\n"
-" pass\n"
-" try:\n"
-" shutil.rmtree('build')\n"
-" except:\n"
-" pass\n"
-"os.remove(OutFileName)\n"
-;
-/*****************************************************************************/
-/* Converts a python script to an executable if py2exe is installed */
-
-void mhmakefileparser::CreatePythonExe(const string &FullCommand)
-{
- /* First create a python script to run */
- cout << "Converting "<<FullCommand<<endl;
-
- string PythonScript;
- PythonScript+=PythonScriptPart1;
- PythonScript+=FullCommand;
- PythonScript+=PythonScriptPart2;
- PythonScript+=GetPythonExe();
- PythonScript+=PythonScriptPart3;
-
- char Filename[MAX_PATH];
- int Nr=0;
- FILE *pFile=(FILE*)1;
- while (1)
- {
- sprintf(Filename,"%s\\tmp%d.py",m_MakeDir->GetFullFileName().c_str(),Nr);
- pFile=fopen(Filename,"r");
- if (!pFile)
- break;
- fclose(pFile);
- Nr++;
- }
- pFile=fopen(Filename,"w");
- fprintf(pFile,"%s",PythonScript.c_str());
- fclose(pFile);
-
- string GenExeCommand=GetPythonExe();
- GenExeCommand+=QuoteFileName(Filename);
-
- string Output;
- ExecuteCommand(GenExeCommand,&Output);
-
- remove(Filename);
-}
-#endif
-
/*****************************************************************************/
int mhmakefileparser::SearchPath(const char *szCommand, const char *pExt, size_t Len, char *szFullCommand,char **pFilePart) const
{
@@ -897,47 +683,7 @@ string mhmakefileparser::GetFullCommand(string Command)
if (!FullCommand.empty())
{
Found=true;
- #ifdef WIN32
- /* Check if a python script also exists, is so try generating the executable again. */
- string PythonFullCommand=SearchCommand(Command,".py");
Command=FullCommand;
- if (!PythonFullCommand.empty()&&s_Py2ExeInstalled)
- {
- fileinfo* pExeFile=GetFileInfo(FullCommand,m_MakeDir);
- fileinfo* pPyFile=GetFileInfo(PythonFullCommand,m_MakeDir);
- bool bBuild=false;
- if (pExeFile->GetDate().IsOlder(pPyFile->GetDate()))
- {
- bBuild=true;
- }
- if (!bBuild)
- {
- deps_t Autodeps;
- GetAutoDeps(pPyFile, Autodeps);
- deps_t::iterator It=Autodeps.begin();
- while (It!=Autodeps.end())
- {
- if (pExeFile->GetDate().IsOlder((*It)->GetDate()))
- {
- bBuild=true;
- break;
- }
- It++;
- }
- }
- if (bBuild)
- {
- if (pExeFile->Exists())
- remove(pExeFile->GetFullFileName().c_str());
- CreatePythonExe(PythonFullCommand);
- // Invalidate the exe date since it could have been recreated by the CreatePythonExe
- pExeFile->InvalidateDate();
- }
-
- }
- #else
- Command=FullCommand;
- #endif
}
else
{
@@ -945,29 +691,6 @@ string mhmakefileparser::GetFullCommand(string Command)
if (!FullCommand.empty())
{
Found=true;
- #ifdef WIN32
- /* Now first try to create an executable for it */
- if (s_Py2ExeInstalled)
- {
- fileinfo* pExeFile;
- CreatePythonExe(FullCommand);
- string ExeFullCommand=SearchCommand(Command,EXEEXT);
- if (!ExeFullCommand.empty())
- {
- pExeFile=GetFileInfo(ExeFullCommand,m_MakeDir);
- pExeFile->InvalidateDate(); // The file was just generated, make sure the correct date is taken.
- }
- if (ExeFullCommand.empty() || !pExeFile->Exists())
- {
- s_Py2ExeInstalled=false;
- cout << "\nWarning: cannot convert "<<FullCommand<<".\nCompilation will be faster by installing py2exe.\n\n";
- Command=GetPythonExe()+QuoteFileName(FullCommand);
- }
- else
- Command=ExeFullCommand;
- }
- else
- #endif
Command=GetPythonExe()+QuoteFileName(FullCommand);
}
}
diff --git a/tools/mhmake/src/mhmakefileparser.h b/tools/mhmake/src/mhmakefileparser.h
index 49c8aedb3..9f6cb5a96 100644
--- a/tools/mhmake/src/mhmakefileparser.h
+++ b/tools/mhmake/src/mhmakefileparser.h
@@ -373,7 +373,6 @@ public:
return ExecuteCommand(Command, IgnoreError, pOutput);
}
string GetFullCommand(string Command);
- void CreatePythonExe(const string &FullCommand);
static void InitBuildTime();
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 648ca01ee..882ceb325 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "2.3.28"
+#define MHMAKEVER "2.3.29"
class makecommand
{