1 |
#!/usr/bin/env python |
#!/usr/bin/env python |
2 |
# |
# |
3 |
|
# GNU Enterprise Designer - Installation Procedure |
4 |
|
# |
5 |
# Copyright 2001-2003 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
6 |
# |
# |
7 |
# This file is part of GNU Enterprise. |
# This file is part of GNU Enterprise. |
21 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
22 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
23 |
# |
# |
24 |
|
# $Id$ |
25 |
|
|
26 |
import sys |
import sys |
|
import string |
|
27 |
import os |
import os |
|
import os.path |
|
|
|
|
|
from src import VERSION |
|
|
# |
|
|
# hack to deal w/ fact distutils won't |
|
|
# allow us to set absolute path prefix |
|
|
# on windows |
|
|
# |
|
28 |
|
|
29 |
if not 'sdist' in sys.argv: |
from src import PACKAGE, VERSION |
|
if sys.platform != 'win32' and '--prefix' not in sys.argv and '--root' not in sys.argv: |
|
|
os.system ("""cp setup.cfg.in setup.cfg""") |
|
|
else: |
|
|
try: |
|
|
os.remove('setup.cfg') |
|
|
except: |
|
|
pass |
|
30 |
|
|
31 |
try: |
try: |
32 |
import distutils |
from gnue.common.setup import GSetup |
|
from distutils.command.build_scripts import build_scripts |
|
|
from distutils.command.build import build |
|
|
from setupext import Data_Files, install_Data_Files |
|
33 |
except ImportError: |
except ImportError: |
34 |
print """ |
print "You need GNUe-Common 0.5.2 or newer installed to install %s" % PACKAGE |
35 |
Setup requires that python's distutils be |
sys.exit (1) |
|
installed. You can get a copy of it from |
|
|
http://www.python.org/sigs/distutils-sig/ |
|
|
""" |
|
|
sys.exit() |
|
|
|
|
|
|
|
|
if 'sdist' in sys.argv: |
|
36 |
|
|
37 |
print "We are going to create the man pages for our tools." |
# ============================================================================= |
|
os.system( """ |
|
|
if [ ! -e man ] |
|
|
then |
|
|
mkdir man |
|
|
fi |
|
|
cd man |
|
|
../scripts/gfdes --generate-man-page |
|
|
""") |
|
38 |
|
|
39 |
|
class setup (GSetup): |
40 |
|
|
41 |
|
# --------------------------------------------------------------------------- |
42 |
# Skip dependency checks? |
# Definition of basic parameters for distribution and installation. |
43 |
try: |
# Please add new files/directories that should be installed here. |
44 |
index = sys.argv.index('--skip-tests') |
# Note that you also have to add them to MANIFEST.in. |
45 |
print "Skipping dependency checks..." |
# --------------------------------------------------------------------------- |
46 |
doTests = 0 |
|
47 |
sys.argv.pop(index) |
def set_params (self, params): |
48 |
|
|
49 |
except ValueError: |
# The Work |
50 |
doTests = 1 |
params ["name"] = PACKAGE |
51 |
|
params ["version"] = VERSION |
52 |
|
params ["description"] = "GNU Enterprise Designer" |
53 |
|
params ["long_description"] = "" |
54 |
if doTests and 'build' in sys.argv: |
params ["license"] = "GPL" |
55 |
# # Verify that PyXML is installed |
|
56 |
# try: |
# The Author |
57 |
# print "Checking for PyXML....", |
params ["author"] = "GNU Enterprise Team" |
58 |
# from xml.sax import saxexts |
params ["author_email"] = "gnue-dev@gnu.org" |
59 |
# from xml.sax import saxlib |
params ["url"] = "http://www.gnue.org" |
60 |
# print "OK" |
|
61 |
# except ImportError: |
# The Programs |
62 |
# print """ |
params ["package_dir"] = {"gnue.designer": "src"} |
63 |
#Your system does not appear to have the |
params ["scripts"] = ["scripts/gnue-designer"] |
64 |
#PyXML module installed. GNUe Forms will |
|
65 |
#not function without it. It is available |
# The Data |
66 |
#at http://sourceforge.net/projects/pyxml |
imagefiles = self.allfiles ("images") |
67 |
#""" |
docfiles = self.allfiles ("doc") |
68 |
# sys.exit() |
|
69 |
|
params ["data_files"] = \ |
70 |
# |
[("share/gnue/images/designer", imagefiles), |
71 |
# Verify at least one UI is installed |
("share/doc/gnue-designer", docfiles)] |
72 |
# |
|
73 |
UIOK = 0 |
# --------------------------------------------------------------------------- |
74 |
|
# Build files to be distributed and installed: |
75 |
# wxPython |
# Should generate the files that go in a distribution but aren't in CVS. |
76 |
try: |
# Gets called on sdist (always) and on build/install (only when run from CVS). |
77 |
print " wxPython....", |
# --------------------------------------------------------------------------- |
78 |
from wxPython.wx import * |
|
79 |
print "OK" |
def build_files (self): |
80 |
UIOK = 1 |
# nothing to do here |
81 |
except ImportError: |
pass |
82 |
print "No" |
|
83 |
|
# --------------------------------------------------------------------------- |
84 |
if UIOK != 1: |
# Check dependencies for installation: |
85 |
print """ |
# Should sys.exit(1) in case any requirement isn't met. |
86 |
No valid UI drivers are installed on this machine: |
# Gets called on install. |
87 |
wxPython - www.wxpython.org |
# --------------------------------------------------------------------------- |
88 |
|
|
89 |
|
def check_dependencies (self): |
90 |
|
|
91 |
|
# ------------------------------------------------------------------------- |
92 |
|
# Verify at least one UI is installed |
93 |
|
UIOK = 0 |
94 |
|
|
95 |
|
# wxPython |
96 |
|
# print "checking wxPython library" |
97 |
|
# try: |
98 |
|
# import wxPython |
99 |
|
# UIOK = 1 |
100 |
|
# except ImportError: |
101 |
|
# pass |
102 |
|
UIOK = 1 # FIXME: wxPython import also fails when we don't run under X |
103 |
|
|
104 |
|
if UIOK != 1: |
105 |
|
print "---" |
106 |
|
print """ |
107 |
|
No valid UI drivers are installed on this machine. |
108 |
|
Please install one of the following packages: |
109 |
|
wxPython - www.wxpython.org |
110 |
|
The file 'INSTALL' contains more information about dependencies. |
111 |
""" |
""" |
112 |
sys.exit() |
sys.exit (1) |
|
|
|
|
|
|
|
# Site config stuff |
|
|
try: |
|
|
index = sys.argv.index('--cfg-file') |
|
|
site_config = os.path.join(os.path.abspath(sys.argv[index+1])) |
|
|
sys.argv.pop(index) |
|
|
sys.argv.pop(index) |
|
|
config_line = "os.environ['GNUE_INSTALLED_SITE_CFG']='%s'\n" % site_config |
|
|
|
|
|
except ValueError: |
|
|
config_line = "" |
|
|
|
|
|
|
|
|
class my_build_scripts(build_scripts): |
|
|
def finalize_options(self): |
|
|
build_scripts.finalize_options(self) |
|
|
|
|
|
if self.finalized: |
|
|
return |
|
|
|
|
|
dict = self.distribution.get_option_dict("install") |
|
|
|
|
|
if sys.platform != 'win32': |
|
|
gnue_env = \ |
|
|
"#######\n" \ |
|
|
+ "# The following variable were set when GNUe was installed\n" \ |
|
|
+ "import os, sys\n" \ |
|
|
+ "sys.path.append('%s')\n" % dict['install_lib'][1] \ |
|
|
+ "INST_GNUE_CONNECTIONS='%s/etc/connections.conf'\n" % dict['prefix'][1] \ |
|
|
+ "os.environ['INSTALL_LIB']='%s'\n" % dict['install_lib'][1] \ |
|
|
+ "os.environ['INSTALL_PREFIX']='%s'\n" % dict['prefix'][1] \ |
|
|
+ config_line \ |
|
|
+ "#######\n" |
|
|
else: |
|
|
gnue_env = \ |
|
|
"#######\n" \ |
|
|
+ "# The following variables were set when GNUe was installed\n" \ |
|
|
+ "# (Generated for a Win32 system)\n" \ |
|
|
+ "import os, sys\n" \ |
|
|
+ "if __name__ == '__main__': \n" \ |
|
|
+ " _BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'..'))\n" \ |
|
|
+ " try:\n" \ |
|
|
+ " os.environ['PATH']= os.path.abspath(os.path.dirname(sys.argv[0])) + ';' + os.environ['PATH']\n" \ |
|
|
+ " except KeyError:\n" \ |
|
|
+ " os.environ['PATH']= os.path.abspath(os.path.dirname(sys.argv[0]))\n" \ |
|
|
+ "else: \n" \ |
|
|
+ " _BASE = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))\n" \ |
|
|
+ "INST_GNUE_CONNECTIONS=os.path.join(_BASE,'etc','connections.conf')\n" \ |
|
|
+ "os.environ['INSTALL_PREFIX']=_BASE\n" \ |
|
|
+ "os.environ['INSTALL_LIB']=_BASE\n" \ |
|
|
+ "os.putenv('PYTHONCASEOK','1')\n" \ |
|
|
+ "if os.path.isdir(os.path.join(_BASE,'extras')):\n" \ |
|
|
+ " sys.path.append(os.path.join(_BASE,'extras'))\n" \ |
|
|
+ config_line \ |
|
|
+ "#######\n\n" |
|
|
|
|
|
|
|
|
for script in self.scripts: |
|
|
|
|
|
fin = open(script+".in", "r") |
|
|
fout = open(script, "w") |
|
|
|
|
|
print "Generating script %s from %s.in" % (script,script) |
|
|
|
|
|
lines = fin.readlines() |
|
|
|
|
|
for i in range(0, len(lines)): |
|
|
if string.strip(lines[i]) == "__GNUEENV__": |
|
|
lines[i] = gnue_env |
|
|
|
|
|
fout.writelines(lines) |
|
|
|
|
|
fin.close() |
|
|
fout.close() |
|
|
|
|
|
|
|
|
|
|
|
docfiles = [] |
|
|
#for file in ('doc/DevelopersGuide-Forms.txt', |
|
|
# 'doc/DevelopersGuide-Forms.pdf'): |
|
|
# if os.path.isfile(file): |
|
|
# docfiles.append(file) |
|
|
# else: |
|
|
# print "WARNING: File %s does not exist... not installing!" % file |
|
|
|
|
|
manfiles = [] |
|
|
for file in ('man/gnue-designer.1',): |
|
|
if os.path.isfile(file): |
|
|
manfiles.append(file) |
|
|
else: |
|
|
print "WARNING: File %s does not exist... not installing!" % file |
|
|
|
|
|
dfiles = [ |
|
|
Data_Files( |
|
|
base_dir = 'install_data', |
|
|
copy_to = '', |
|
|
template = ['recursive-include translations *', |
|
|
'prune translations/CVS'], |
|
|
preserve_path = 1), |
|
|
Data_Files( |
|
|
base_dir = 'install_data', |
|
|
copy_to = 'doc/common', |
|
|
template = ['recursive-include doc *', |
|
|
'prune doc/CVS'], |
|
|
strip_dirs = 1, # This is a number, not true/false |
|
|
preserve_path = 1) |
|
|
] |
|
|
|
|
|
# |
|
|
# Verify DB driver of some sort installed |
|
|
# |
|
|
# Maybe later :) |
|
|
|
|
|
dfiles = [ |
|
|
Data_Files( |
|
|
base_dir = 'install_data', |
|
|
copy_to = 'doc/designer', |
|
|
template = ['recursive-include doc *.pdf', |
|
|
'recursive-include doc *.html', |
|
|
'recursive-include doc *.txt', |
|
|
'prune doc/CVS'], |
|
|
strip_dirs = 1, # This is a number, not true/false |
|
|
preserve_path = 1), |
|
|
Data_Files( |
|
|
base_dir = 'install_data', |
|
|
copy_to = 'shared/images/designer', |
|
|
template = ['recursive-include images *.png', |
|
|
'recursive-include images *.xpm', |
|
|
'recursive-include images *.ico', |
|
|
'prune images/CVS'], |
|
|
strip_dirs = 1, # This is a number, not true/false |
|
|
preserve_path = 1), |
|
|
Data_Files( |
|
|
base_dir = 'install_data', |
|
|
copy_to = 'man/man1', |
|
|
template = ['recursive-include man *'], |
|
|
strip_dirs = 1, # This is a number, not true/false |
|
|
preserve_path = 1) ] |
|
|
|
|
|
# |
|
|
# You can run: |
|
|
# $ GNUE_VERSION_SUFFIX=-pre1 ./setup.py sdist |
|
|
# and the packages will be created as GNUe-App-0.x.x-pre1.tar.gz |
|
|
# |
|
|
try: |
|
|
suffix = os.environ['GNUE_VERSION_SUFFIX'] |
|
|
except KeyError: |
|
|
suffix = "" |
|
|
|
|
|
distutils.core.setup (name = "GNUe-Designer", |
|
|
version = VERSION+suffix, |
|
|
description = "GNU Enterprise Designer", |
|
|
long_description = "", |
|
|
author = "GNUe Designer Team", |
|
|
author_email = "info@gnue.org", |
|
|
url = "http://www.gnue.org", |
|
|
# Override certain command classes with our own ones |
|
|
data_files = dfiles, |
|
|
packages = ["gnue.designer", |
|
|
"gnue.designer.base", |
|
|
"gnue.designer.base.docks", |
|
|
"gnue.designer.base.settings", |
|
|
"gnue.designer.base.tools", |
|
|
"gnue.designer.base.settings", |
|
|
"gnue.designer.base.startup", |
|
|
"gnue.designer.base.uihelpers", |
|
|
"gnue.designer.forms", |
|
|
"gnue.designer.forms.LayoutEditor", |
|
|
"gnue.designer.forms.LayoutEditor.renderers", |
|
|
"gnue.designer.forms.LayoutEditor.renderers.Base", |
|
|
"gnue.designer.forms.LayoutEditor.renderers.native", |
|
|
"gnue.designer.forms.LayoutEditor.renderers.curses", |
|
|
"gnue.designer.forms.events", |
|
|
"gnue.designer.forms.wizards", |
|
|
"gnue.designer.navigator", |
|
|
"gnue.designer.navigator.wizards", |
|
|
"gnue.designer.reports", |
|
|
"gnue.designer.reports.Default", |
|
|
"gnue.designer.reports.Standard", |
|
|
"gnue.designer.reports.Labels", |
|
|
"gnue.designer.reports.MailMerge", |
|
|
"gnue.designer.reports.SimpleTabulation", |
|
|
"gnue.designer.reports.wizards", |
|
|
"gnue.designer.schema", |
|
|
"gnue.designer.schema.DiaEditor", |
|
|
"gnue.designer.schema.wizards", |
|
|
"gnue.designer.templates", |
|
|
"gnue.designer.templates.forms", |
|
|
"gnue.designer.templates.reports", |
|
|
"gnue.designer.templates.schema" |
|
|
], |
|
|
package_dir = {"gnue.designer" : "src", |
|
|
}, |
|
|
scripts = ["scripts/gnue-designer"], |
|
|
cmdclass = {'install_data':install_Data_Files, |
|
|
'build_scripts':my_build_scripts}, |
|
|
) |
|
|
|
|
|
if not 'sdist' in sys.argv: |
|
|
if sys.platform != 'win32': |
|
|
os.system (""" /bin/rm -rf setup.cfg""") |
|
|
|
|
113 |
|
|
114 |
|
# ============================================================================= |
115 |
|
|
116 |
|
if __name__ == "__main__": |
117 |
|
setup().run() |