File: setup.py

package info (click to toggle)
gnue-forms 0.5.11-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,384 kB
  • ctags: 1,577
  • sloc: python: 12,904; sql: 579; makefile: 28
file content (239 lines) | stat: -rwxr-xr-x 9,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#!/usr/bin/env python
#
# GNU Enterprise Forms - Installation Procedure
#
# Copyright 2001-2005 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: setup.py,v 1.92 2003/10/28 09:45:38 siesel Exp $

import sys
import os

from src import PACKAGE, VERSION

try:
  from gnue.common.setup import GSetup
except ImportError:
  print "You need GNUe-Common 0.5.2 or newer installed to install %s" % PACKAGE
  sys.exit (1)

# =============================================================================

class setup (GSetup.GSetup):

  package = PACKAGE.lower()

  # ---------------------------------------------------------------------------
  # Definition of basic parameters for distribution and installation.
  # Please add new files/directories that should be installed here.
  # Note that you also have to add them to MANIFEST.in.
  # ---------------------------------------------------------------------------

  def set_params (self, params):

    # The Work
    params ["name"]             = self.package
    params ["version"]          = VERSION
    params ["description"]      = "GNU Enterprise Forms"
    params ["long_description"] = ""
    params ["license"]          = "GPL"

    # The Author
    params ["author"]       = "GNU Enterprise Team"
    params ["author_email"] = "gnue-dev@gnu.org"
    params ["url"]          = "http://www.gnue.org"

    # The Programs
    params ["package_dir"] = {"gnue.forms": "src"}
    params ["scripts"]     = ["scripts/gnue-forms"]

    # The Data
    dialogfiles = self.allfiles ("dialogs")
    image01files = self.allfiles ("images")
    image02files = self.allfiles ("images/default")
    image03files = self.allfiles ("images/gnome")
    image04files = self.allfiles ("images/kde3")
#    image05files = self.allfiles ("images/macosx")
#    image06files = self.allfiles ("images/winxp")
    man1files   = self.allfiles ("doc/man")
    docfiles    = self.allfiles ("doc")
    samp01files = self.allfiles ("samples")
    samp02files = self.allfiles ("samples/dialog")
    samp03files = self.allfiles ("samples/history")
    samp04files = self.allfiles ("samples/intro")
    samp05files = self.allfiles ("samples/inventory")
    samp06files = self.allfiles ("samples/inventory/forms")
    samp07files = self.allfiles ("samples/inventory/sql")
    samp08files = self.allfiles ("samples/location")
    samp09files = self.allfiles ("samples/location/forms")
    samp10files = self.allfiles ("samples/location/sql")
    samp11files = self.allfiles ("samples/po")
    samp12files = self.allfiles ("samples/simple")
    samp13files = self.allfiles ("samples/track")
    samp14files = self.allfiles ("samples/track/forms")
    samp15files = self.allfiles ("samples/track/sql")
    samp16files = self.allfiles ("samples/vendor")
    samp17files = self.allfiles ("samples/vendor/forms")
    samp18files = self.allfiles ("samples/zipcode")
    samp19files = self.allfiles ("samples/connections")

    params ["data_files"] = \
      [("share/gnue/dialogs",                            dialogfiles),
       ("share/gnue/images/forms",                       image01files),
       ("share/gnue/images/forms/default",               image02files),
       ("share/gnue/images/forms/gnome",                 image03files),
       ("share/gnue/images/forms/kde3",                  image04files),
#       ("share/gnue/images/forms/macosx",                image05files),
#       ("share/gnue/images/forms/winxp",                 image06files),
       ("share/man/man1",                                man1files),
       ("share/doc/gnue-forms",                          docfiles),
       ("share/doc/gnue-forms/examples",                 samp01files),
       ("share/doc/gnue-forms/examples/dialog",          samp02files),
       ("share/doc/gnue-forms/examples/history",         samp03files),
       ("share/doc/gnue-forms/examples/intro",           samp04files),
       ("share/doc/gnue-forms/examples/inventory",       samp05files),
       ("share/doc/gnue-forms/examples/inventory/forms", samp06files),
       ("share/doc/gnue-forms/examples/inventory/sql",   samp07files),
       ("share/doc/gnue-forms/examples/location",        samp08files),
       ("share/doc/gnue-forms/examples/location/forms",  samp09files),
       ("share/doc/gnue-forms/examples/location/sql",    samp10files),
       ("share/doc/gnue-forms/examples/po",              samp11files),
       ("share/doc/gnue-forms/examples/simple",          samp12files),
       ("share/doc/gnue-forms/examples/track",           samp13files),
       ("share/doc/gnue-forms/examples/track/forms",     samp14files),
       ("share/doc/gnue-forms/examples/track/sql",       samp15files),
       ("share/doc/gnue-forms/examples/vendor",          samp16files),
       ("share/doc/gnue-forms/examples/vendor/forms",    samp17files),
       ("share/doc/gnue-forms/examples/zipcode",         samp18files),
       ("share/doc/gnue-forms/examples/connections",     samp19files)]

  # ---------------------------------------------------------------------------
  # Build files to be distributed and installed:
  # Should generate the files that go in a distribution but aren't in SVN.
  # Gets called on sdist (always) and on build/install (only when run from SVN).
  # ---------------------------------------------------------------------------

  def build_files (self, action):
    # nothing to do here
    pass

  # ---------------------------------------------------------------------------
  # Check dependencies for installation:
  # Should sys.exit(1) in case any requirement isn't met.
  # Gets called on install.
  # ---------------------------------------------------------------------------

  def check_dependencies (self):

    # -------------------------------------------------------------------------
    # mxDateTime
    try:
      print "checking mxDateTime library"
      from mx.DateTime import DateTime
    except ImportError:
      print "---"
      print "Could not import the mx.DateTime package."
      print "Please install mxDateTime from the mxtools suite."
      print "The file 'INSTALL' contains more information about dependencies."
      sys.exit (1)

    # -------------------------------------------------------------------------
    # Verify at least one UI is installed
    UIOK = 0

    # PyNcurses
    print "checking Python ncurses library (pyncurses) (currently not working)"
    try:
      import ncurses.form
      UIOK = 0
    except ImportError:
      pass

    # Curses
    print "checking Python curses library (curses) (currently not working)"
    try:
      import curses
      UIOK = 0
    except ImportError:
      pass

    # wxPython
    print "checking wxPython library: ",
    if (os.environ.has_key('DISPLAY') and len(os.environ["DISPLAY"])) or \
       os.name!='posix':
      try:
        from wxPython import wx
        if wx.__version__[0:2]=='2.':
          print "ok (%s)" % wx.__version__
          UIOK = 1
          # WORKAROUND:
          # return now because subsequent import of pygtk will segfault.
          return
        else:
          print "Version 2.3 or greater needed"
      except ImportError:
        pass
    else:
      print "check not possible, X11 not working, assuming wxPython is there"
      UIOK = 1

    # pyGTK 2.0
    print "checking pyGTK 2.0 library: ",
    try:
      import pygtk
      pygtk.require('2.0')
      import gtk
      print 'ok.'
      UIOK = 1
    except ImportError:
      print 'not found.'
    except RuntimeError:
      print 'found (but X is not running).'
      UIOK = 1

    # win32ui
    print "checking win32all extensions: ",
    try:
      import win32ui
      print 'ok.'
      UIOK = 1
      return
    except ImportError:
      print 'not found.'

    # FIXME: We have more UIDrivers, add check for qt!

    if UIOK != 1:
      print "---"
      print """
No valid UI drivers are installed on this machine.
Please install one of the following packages:
  wxPython      - www.wxpython.org
  pyGTK2        - ftp://ftp.gtk.org/pub/gtk/python/v2.0/
  pyncurses     - pyncurses.sourceforge.net
  python curses - Read python install docs on how to activate
The file 'INSTALL' contains more information about dependencies.
"""
      sys.exit (1)

# =============================================================================

if __name__ == "__main__":
  setup().run()