[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Changes to try to make windows builds likelier



Update of /home/minion/cvsroot/src/minion
In directory moria.mit.edu:/tmp/cvs-serv22910

Modified Files:
	setup.py 
Log Message:
Changes to try to make windows builds likelier

Index: setup.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/setup.py,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- setup.py	28 Nov 2003 04:14:03 -0000	1.81
+++ setup.py	3 Dec 2003 23:10:08 -0000	1.82
@@ -124,17 +124,22 @@
       )
 ======================================================================"""
 
-#XXXX005 Use pkg-config when possible, if it exists.
+#XXXX Use pkg-config when possible, if it exists.
 
 if USE_OPENSSL and sys.platform == 'win32':
+    # If we're on windows, insist on finding the libraries in ./contrib/openssl
     INCLUDE_DIRS = []
     STATIC_LIBS = []
     LIBRARY_DIRS = []
 
-    # WWWW Right now, this is hardwired to my openssl installation.
-    INCLUDE_DIRS.append("d:\\openssl\\include")
-    LIBRARY_DIRS.append("D:\\openssl\\lib\\vc")
+    if (not os.path.exists(".\\contrib\\openssl\\include") or
+        not os.path.exists(".\\contrib\\openssl\\lib\\vc")):
+        print ("Can't find openssl: make sure that a compiled openssl "
+               "distribution is stored \nat .\\contrib\\openssl")
+        sys.exit(1)
 
+    INCLUDE_DIRS.append(".\\contrib\\openssl\\include")
+    LIBRARY_DIRS.append(".\\contrib\\openssl\\lib\\vc")
     LIBRARIES = [ "ssleay32", "libeay32", "advapi32" ]
 
 elif USE_OPENSSL:
@@ -315,13 +320,13 @@
 SCRIPT_PATH = os.path.join("build", "mixminion")
 if not os.path.exists("build"):
     os.mkdir("build")
+
 f = open(SCRIPT_PATH, 'wt')
 # Distutils will take care of the executable path, and actually gets angry
 # if we try to be smart on our own. *sigh*.
-#f.write("#!python -O\n")  #disable -O for asserts.
 f.write("#!python\n")
 f.write("import sys\n")
-if pathextra:
+if pathextra and 'py2exe' not in sys.argv:
     f.write("sys.path[0:0] = [%r]\n"%pathextra)
 f.write("""\
 try:
@@ -329,30 +334,27 @@
 except:
     print 'ERROR importing mixminion package.'
     raise
-
-mixminion.Main.main(sys.argv)
 """)
-f.close()
-
-SCRIPTS = [ SCRIPT_PATH ]
-
-if sys.platform == 'win32':
-    f = open(SCRIPT_PATH+"i.py", 'wt')
-    f.write("import sys\n")
-    if pathextra:
-        f.write("sys.path[0:0] = [%r]\n"%pathextra)
+if 'py2exe' in sys.argv:
     f.write("""\
-try:
-    import mixminion.Main
-except:
-    print 'ERROR importing mixminion package.'
-    raise
-
-mixminion.Main.main(sys.argv+['shell'])
+if 1 == 0:
+    # These import statements need to be here so that py2exe knows to
+    # include all of the mixminion libraries.  Main.py imports libraries
+    # conditionally with __import__ --- but that confuses py2exe.
+    import mixminion.Common
+    import mixminion.test
+    import mixminion.benchmark
+    import mixminion.ClientMain
+    import mixminion.server.ServerMain
+    import mixminion.directory.DirMain
 """)
-    f.close()
+if sys.platform == 'win32':
+    f.write("# On win32, we default to shell mode.\n")
+    f.write("if len(sys.argv) == 1: sys.argv.append('shell')\n")
+f.write("\nmixminion.Main.main(sys.argv)\n")
+f.close()
 
-    SCRIPTS.append(SCRIPT_PATH+"i.py")
+SCRIPTS = [ SCRIPT_PATH ]
 
 #======================================================================
 # Define a helper to let us run commands from the compiled code.
@@ -387,8 +389,11 @@
 
     requirePythonDev()
 
+if 'py2exe' in sys.argv:
+    import py2exe
+
 try:
-    # This catches failures to install python2-dev on some Recent Redhats.
+    # This catches failures to install python2-dev on some recent Redhats.
     mf = get_makefile_filename()
     print mf
 except IOError: