[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9661 - trunk/gnue-common/packaging/win32
From: |
johannes |
Subject: |
[gnue] r9661 - trunk/gnue-common/packaging/win32 |
Date: |
Tue, 5 Jun 2007 10:06:17 -0500 (CDT) |
Author: johannes
Date: 2007-06-05 10:06:16 -0500 (Tue, 05 Jun 2007)
New Revision: 9661
Modified:
trunk/gnue-common/packaging/win32/gnue-common.iss
trunk/gnue-common/packaging/win32/setup.cmd
trunk/gnue-common/packaging/win32/setup.py
Log:
More work on packaging for win32
Modified: trunk/gnue-common/packaging/win32/gnue-common.iss
===================================================================
--- trunk/gnue-common/packaging/win32/gnue-common.iss 2007-06-05 08:49:12 UTC
(rev 9660)
+++ trunk/gnue-common/packaging/win32/gnue-common.iss 2007-06-05 15:06:16 UTC
(rev 9661)
@@ -16,6 +16,7 @@
ChangesAssociations=true
CreateAppDir=true
ShowLanguageDialog=yes
+OutputDir=C:\GNUE\dist
OutputBaseFilename=<filename of setup file>
DisableDirPage=true
Modified: trunk/gnue-common/packaging/win32/setup.cmd
===================================================================
--- trunk/gnue-common/packaging/win32/setup.cmd 2007-06-05 08:49:12 UTC (rev
9660)
+++ trunk/gnue-common/packaging/win32/setup.cmd 2007-06-05 15:06:16 UTC (rev
9661)
@@ -3,27 +3,6 @@
REM
REM ---------------------------------------------------------------------------
-REM First, determine where python is installed
-REM ---------------------------------------------------------------------------
-
address@hidden "Guessing the python path ..."
-python -c "import sys; print \"SET PYTHON_PATH=\"+sys.prefix" > guesspp.bat
-python -c "import sys,os.path; print \"SET
PYTHON_DRV=\"+os.path.splitdrive(sys.prefix)[0]" >> guesspp.bat
-python -c "import os; print \"SET CWD=\"+os.getcwd()" >> guesspp.bat
-
-CALL guesspp.bat
-DEL guesspp.bat
-
-IF "%PYTHON_PATH%" == "" (
- @ECHO "*** Cannot guess python path ***"
- GOTO :EXIT
-)
-IF "%CWD%" == "" (
- @ECHO "*** Cannot determine current working directory ***"
- GOTO :EXIT
-)
-
-REM ---------------------------------------------------------------------------
REM Prepare the build environment
REM ---------------------------------------------------------------------------
@@ -34,10 +13,12 @@
RMDIR /S /Q %GNUE_PATH%
)
MKDIR %GNUE_PATH%
+MKDIR %GNUE_PATH%\Scripts
COPY gnue.url %GNUE_PATH%
COPY LICENSE.txt %GNUE_PATH%
-COPY setup.py %PYTHON_PATH%\Scripts
+COPY setup.py %GNUE_PATH%\Scripts
+COPY gnue-common.iss %GNUE_PATH%\Scripts
REM ---------------------------------------------------------------------------
REM Install the package into python's site-packages
@@ -45,43 +26,18 @@
CD ..\..
@ECHO "Installing the package into local site-packages ..."
-python setup.py install
+python setup.py install --prefix=%GNUE_PATH% --install-lib=%GNUE_PATH%\bin
REM ---------------------------------------------------------------------------
-REM Move the stuff installed into site-packages to the build environment
-REM ---------------------------------------------------------------------------
-
address@hidden "Populating the build environment (%GNUE_PATH%) ..."
-xcopy %PYTHON_PATH%\lib\site-packages\gnue\*.py %GNUE_PATH%\bin\gnue /Y /I
-xcopy %PYTHON_PATH%\lib\site-packages\gnue\common\*.py
%GNUE_PATH%\bin\gnue\common /Y /E /I
-xcopy %PYTHON_PATH%\etc\sample.*.conf %GNUE_PATH%\etc\ /Y
-xcopy %PYTHON_PATH%\share\doc %GNUE_PATH%\share\doc\ /Y /E
-xcopy %PYTHON_PATH%\share\gnue %GNUE_PATH%\share\gnue\ /Y /E
-xcopy %PYTHON_PATH%\share\locale %GNUE_PATH%\share\locale\ /Y /E
-
-
-FOR %%x IN (%GNUE_PATH%\etc\sample.*.conf) DO python
%PYTHON_PATH%\tools\scripts\lfcr.py %%x
-
-copy %GNUE_PATH%\etc\sample.gnue.conf %GNUE_PATH%\etc\gnue.conf
-copy %GNUE_PATH%\etc\sample.connections.conf %GNUE_PATH%\etc\connections.conf
-
-
-REM ---------------------------------------------------------------------------
REM Compile everything into an exe
REM ---------------------------------------------------------------------------
@ECHO "Building EXE-File ..."
-PUSHD %PYTHON_PATH%\Scripts
+PUSHD %GNUE_PATH%\Scripts
-IF EXIST "dist" RMDIR /S /Q dist
+python setup.py py2exe -c -d %GNUE_PATH%\bin
-python setup.py py2exe -c %1
-
-xcopy dist %GNUE_PATH%\bin\ /Y
-
-RMDIR /S /Q dist
-
POPD
:EXIT
Modified: trunk/gnue-common/packaging/win32/setup.py
===================================================================
--- trunk/gnue-common/packaging/win32/setup.py 2007-06-05 08:49:12 UTC (rev
9660)
+++ trunk/gnue-common/packaging/win32/setup.py 2007-06-05 15:06:16 UTC (rev
9661)
@@ -1,42 +1,53 @@
-# Usage: python setup.py py2exe -c
-# or python setup.py py2exe -c -k
-# for console apps.
+# GNU Enterprise Common - Setup Script for py2exe
+#
+# Copyright 2001-2007 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: $
import os
import sys
-
import py2exe
+import win32api
+import win32con
from distutils.core import setup
-# The manifest will be inserted as resource into .exe files. This
-# gives the controls the Windows XP appearance (if run on XP).
-manifest = '''
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-<assemblyIdentity
- version="5.0.0.0"
- processorArchitecture="x86"
- name="Controls"
- type="win32"
-/>
-<description>GNU Enterprise</description>
-<dependency>
- <dependentAssembly>
- <assemblyIdentity
- type="win32"
- name="Microsoft.Windows.Common-Controls"
- version="6.0.0.0"
- processorArchitecture="X86"
- publicKeyToken="6595b64144ccf1df"
- language="*"
- />
- </dependentAssembly>
-</dependency>
-</assembly>
-'''
+# -----------------------------------------------------------------------------
+# Constants used by this setup
+# -----------------------------------------------------------------------------
+# The path where we are creating the build environment for the setup compiler
+GNUE_PATH='C:\\GNUE'
+# The config files to rewrite (wrt line-ending)
+CFG_FILES = ['gnue.conf', 'connections.conf']
+# The InnoSetup configuration file
+ISS_FILE = 'gnue-common.iss'
+
+# -----------------------------------------------------------------------------
+# Create a list of all modules in the standard library
+# -----------------------------------------------------------------------------
+
def getimports(libdir):
+ """
+ Returns a list of all modules in the standard python library.
+ """
importlist = []
for entry in os.listdir(libdir):
if entry.startswith('_') or '-' in entry or \
@@ -50,33 +61,94 @@
return importlist
-standardlib = getimports(os.path.join(sys.prefix,'Lib'))
-setup( \
- console = ['gnue-schema'],
- options = {"py2exe":
- {"typelibs": [('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}',0,1,1)],
- #'Microsoft Internet Controls'
- "packages": ["encodings",
- "mx",
- "_xmlplus",
- "PIL"],
- "includes": standardlib +
- ["afxres",
- "ImageWin",
- "BmpImagePlugin",
- "GifImagePlugin",
- "JpegImagePlugin",
- "PpmImagePlugin",
- "PngImagePlugin",
- "TiffImagePlugin",
- "libxml2",
- "libxslt"],
- "dll_excludes": ["msvcp60.dll",
- "tcl84.dll",
- "tk84.dll",
- "oci.dll"],
- "excludes": ["gnue"]
+# -----------------------------------------------------------------------------
+# Run the setup to create all the exe files in the gnue-common package
+# -----------------------------------------------------------------------------
+def create_exe_files():
+ """
+ Create gnue-schema.exe (which is currently the only exe supplied by
+ gnue-common.
+ """
+
+ setup( \
+ console = ['gnue-schema'],
+ options = {"py2exe":
+ {"typelibs": [('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}',0,1,1)],
+ "packages": ["encodings",
+ "mx",
+ "_xmlplus"],
+ "includes": getimports(os.path.join(sys.prefix, 'Lib')) +
+ ["libxml2",
+ "libxslt"],
+ "dll_excludes": ["msvcp60.dll",
+ "tcl84.dll",
+ "tk84.dll",
+ "oci.dll"],
+ "excludes": ["gnue"]
+ }
}
- }
-)
+ )
+
+
+# -----------------------------------------------------------------------------
+# Finalize the build environment
+# -----------------------------------------------------------------------------
+
+def finalize_build_env():
+ """
+ Finalize the build environment ready to be processed by the setup compiler
+ """
+
+ for name in CFG_FILES:
+ fhd = open(os.path.join(GNUE_PATH, 'etc', 'sample.%s' % name))
+ data = [line.strip() for line in fhd.readlines()]
+ out = open(os.path.join(GNUE_PATH, 'etc', name), 'wb')
+ for line in data:
+ out.write('%s%s' % (line, os.linesep))
+ out.close()
+ fhd.close()
+
+
+# -----------------------------------------------------------------------------
+# Examine the registry to find out where the InnoSetup compiler is located
+# -----------------------------------------------------------------------------
+
+def get_istool():
+ root = win32con.HKEY_CLASSES_ROOT
+ item = "InnoSetupScriptFile\\shell\\OpenWithISTool"
+ try:
+ path = None
+ key = win32api.RegOpenKeyEx(root, item, 0, win32con.KEY_READ)
+ value = win32api.RegQueryValue(key, "command")
+ if isinstance(value, basestring):
+ path = value.split(' ', 1)[0]
+ except:
+ pass
+
+ return path
+
+# -----------------------------------------------------------------------------
+# Compile the setup
+# -----------------------------------------------------------------------------
+
+def compile_setup():
+
+ istool = get_istool()
+ if not istool:
+ print "Cannot find ISTool.exe"
+ sys.exit(1)
+
+ cmd = '%s -compile %s' % (istool, ISS_FILE)
+ os.system(cmd)
+
+
+# =============================================================================
+# Main program
+# =============================================================================
+
+create_exe_files()
+
+finalize_build_env()
+
+compile_setup()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9661 - trunk/gnue-common/packaging/win32,
johannes <=