~ubuntu-branches/ubuntu/gutsy/hplip/gutsy-security

« back to all changes in this revision

Viewing changes to check.py

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2006-09-15 18:00:07 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060915180007-96mez3nck3oy5wij
Tags: 1.6.7-2ubuntu1
* Merge from debian unstable.
* Removed patches 50_ui-supportform-cleanups.dpatch and
  55_ui-supportform-debian.dpatch, there is no support window in the HP
  toolbox any more.
* HPLIP (file io/hpiod/usbext.h) includes linux/compiler.h which is not
  part of Ubuntu Linux and not needed. Removed the include with patch
  80_no-compiler.h.dpatch.
* debian/control: Let the "Conflicts:" of hpijs-ppds be only a "Breaks:"
  to facilitate an update from the previous version when both hpijs and
  hpijs-ppds are installed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# Author: Don Welch
21
21
#
22
22
 
23
 
__version__ = '2.0'
 
23
__version__ = '2.1'
24
24
__title__ = 'Dependency/Version Check Utility'
25
25
__doc__ = "Check the existence and versions of HPLIP dependencies."
26
26
 
74
74
        log.error("Not found.")
75
75
        return False
76
76
 
 
77
log.set_module("hp-check")
77
78
 
78
79
try:
79
80
    opts, args = getopt.getopt(sys.argv[1:], 'hl:g', 
114
115
status, output = run('uname -a')
115
116
log.info("--> %s" % output)
116
117
 
117
 
log.info(utils.bold("\nCurrently (previously) installed version..."))
 
118
log.info(utils.bold("\nCurrently installed version..."))
118
119
v = sys_cfg.hplip.version
119
120
if v:
120
121
    log.info("--> %s" % v )
148
149
else:
149
150
    log.info("--> OK")
150
151
 
 
152
pyqt = False
151
153
# PyQt
152
154
log.info("Checking for PyQt...")
153
155
try:
156
158
    log.error("PyQt not installed.")
157
159
else:
158
160
    log.info("--> OK")
159
 
 
160
 
# check version of Qt
161
 
log.info("Checking Qt version...")
162
 
 
163
 
qtMajor = int(qVersion().split('.')[0])
164
 
log.debug("qVersion() = %s" % qVersion())
165
 
log.info("--> Version %s installed." % qVersion())
166
 
 
167
 
if qtMajor < MINIMUM_QT_MAJOR_VER: 
168
 
    log.error("Incorrect version of Qt installed. Ver. 3.0 or greater required.")
169
 
else:
170
 
    log.info("--> OK")
171
 
 
172
 
log.info("Checking SIP version...")
173
 
 
174
 
try:
175
 
    import pyqtconfig
176
 
except ImportError:
177
 
    log.error("Unable to import pyqtconfig. PyQt may not be properly installed.")
178
 
else:
179
 
    c = pyqtconfig.Configuration()
180
 
    log.info("--> Version %s installed" % c.sip_version_str)
181
 
    log.info("--> OK")
182
 
 
183
 
log.info("Checking PyQt version...")
184
 
 
185
 
#check version of PyQt
186
 
try:
187
 
    pyqtVersion = PYQT_VERSION_STR
188
 
    log.debug("PYQT_VERSION_STR = %s" % pyqtVersion)
189
 
except:
190
 
    pyqtVersion = PYQT_VERSION
191
 
    log.debug("PYQT_VERSION = %s" % pyqtVersion)
192
 
 
193
 
while pyqtVersion.count('.') < 2:
194
 
    pyqtVersion += '.0'
195
 
 
196
 
(maj_ver, min_ver, pat_ver) = pyqtVersion.split('.')
197
 
 
198
 
if pyqtVersion.find('snapshot') >= 0:
199
 
    log.warning("A non-stable snapshot version of PyQt is installed.")
200
 
else:    
201
 
    try:
202
 
        maj_ver = int(maj_ver)
203
 
        min_ver = int(min_ver)
204
 
        pat_ver = int(pat_ver)
205
 
    except ValueError:
206
 
        maj_ver, min_ver, pat_ver = 0, 0, 0
207
 
    else:
208
 
        log.info("--> Version %d.%d.%d installed." % (maj_ver, min_ver, pat_ver))
209
 
        
210
 
    if maj_ver < MINIMUM_PYQT_MAJOR_VER or \
211
 
        (maj_ver == MINIMUM_PYQT_MAJOR_VER and min_ver < MINIMUM_PYQT_MINOR_VER):
212
 
        log.error("HPLIP may not function properly with the version of PyQt that is installed (%d.%d.%d)." % (maj_ver, min_ver, pat_ver))
213
 
        log.error("Incorrect version of PyQt installed. Ver. %d.%d or greater required." % (MINIMUM_PYQT_MAJOR_VER, MINIMUM_PYQT_MINOR_VER))
214
 
    else:
215
 
        log.info("--> OK")
 
161
    pyqt = True
 
162
 
 
163
if pyqt:
 
164
    # check version of Qt
 
165
    log.info("Checking Qt version...")
 
166
    
 
167
    qtMajor = int(qVersion().split('.')[0])
 
168
    log.debug("qVersion() = %s" % qVersion())
 
169
    log.info("--> Version %s installed." % qVersion())
 
170
    
 
171
    if qtMajor < MINIMUM_QT_MAJOR_VER: 
 
172
        log.error("Incorrect version of Qt installed. Ver. 3.0 or greater required.")
 
173
    else:
 
174
        log.info("--> OK")
 
175
    
 
176
    log.info("Checking SIP version...")
 
177
    
 
178
    try:
 
179
        import pyqtconfig
 
180
    except ImportError:
 
181
        log.error("Unable to import pyqtconfig. PyQt may not be properly installed.")
 
182
    else:
 
183
        c = pyqtconfig.Configuration()
 
184
        log.info("--> Version %s installed" % c.sip_version_str)
 
185
        log.info("--> OK")
 
186
    
 
187
    log.info("Checking PyQt version...")
 
188
    
 
189
    #check version of PyQt
 
190
    try:
 
191
        pyqtVersion = PYQT_VERSION_STR
 
192
        log.debug("PYQT_VERSION_STR = %s" % pyqtVersion)
 
193
    except:
 
194
        pyqtVersion = PYQT_VERSION
 
195
        log.debug("PYQT_VERSION = %s" % pyqtVersion)
 
196
    
 
197
    while pyqtVersion.count('.') < 2:
 
198
        pyqtVersion += '.0'
 
199
    
 
200
    (maj_ver, min_ver, pat_ver) = pyqtVersion.split('.')
 
201
    
 
202
    if pyqtVersion.find('snapshot') >= 0:
 
203
        log.warning("A non-stable snapshot version of PyQt is installed.")
 
204
    else:    
 
205
        try:
 
206
            maj_ver = int(maj_ver)
 
207
            min_ver = int(min_ver)
 
208
            pat_ver = int(pat_ver)
 
209
        except ValueError:
 
210
            maj_ver, min_ver, pat_ver = 0, 0, 0
 
211
        else:
 
212
            log.info("--> Version %d.%d.%d installed." % (maj_ver, min_ver, pat_ver))
 
213
            
 
214
        if maj_ver < MINIMUM_PYQT_MAJOR_VER or \
 
215
            (maj_ver == MINIMUM_PYQT_MAJOR_VER and min_ver < MINIMUM_PYQT_MINOR_VER):
 
216
            log.error("HPLIP may not function properly with the version of PyQt that is installed (%d.%d.%d)." % (maj_ver, min_ver, pat_ver))
 
217
            log.error("Incorrect version of PyQt installed. Ver. %d.%d or greater required." % (MINIMUM_PYQT_MAJOR_VER, MINIMUM_PYQT_MINOR_VER))
 
218
        else:
 
219
            log.info("--> OK")
216
220
 
217
221
log.info(utils.bold("\nChecking for library dependencies..."))
218
222
ldconfig = utils.which('ldconfig')
219
223
status, output = run('%s -p' % os.path.join(ldconfig, 'ldconfig'))
220
224
 
221
 
checklib(output, "libsnmp")
 
225
checklib(output, "libnetsnmp")
222
226
checklib(output, "libjpeg")
223
227
checklib(output, "libusb")
224
228
checklib(output, "libcrypto")
243
247
    log.info("--> %s" % output.splitlines()[0])
244
248
    log.info("--> OK")
245
249
 
246
 
log.info("Checking automake...")
247
 
status, output = run('automake --version')
248
 
if status != 0:
249
 
    log.error("Not found!")
250
 
else:
251
 
    log.info("--> %s" % output.splitlines()[0])
252
 
    log.info("--> OK")
253
 
    
254
 
log.info("Checking autoconf...")
255
 
status, output = run('autoconf --version')
256
 
if status != 0:
257
 
    log.error("Not found!")
258
 
else:
259
 
    log.info("--> %s" % output.splitlines()[0])
260
 
    log.info("--> OK")
 
250
##log.info("Checking automake...")
 
251
##status, output = run('automake --version')
 
252
##if status != 0:
 
253
##    log.error("Not found!")
 
254
##else:
 
255
##    log.info("--> %s" % output.splitlines()[0])
 
256
##    log.info("--> OK")
 
257
##    
 
258
##log.info("Checking autoconf...")
 
259
##status, output = run('autoconf --version')
 
260
##if status != 0:
 
261
##    log.error("Not found!")
 
262
##else:
 
263
##    log.info("--> %s" % output.splitlines()[0])
 
264
##    log.info("--> OK")
261
265
 
262
266
log.info("Checking make...")
263
267
status, output = run('make --version')