~ubuntu-branches/ubuntu/vivid/hplip/vivid-security

« back to all changes in this revision

Viewing changes to base/smart_install.py

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2015-02-04 21:18:00 UTC
  • mfrom: (1.8.2)
  • Revision ID: package-import@ubuntu.com-20150204211800-3ahjuezv75ah97zz
Tags: 3.15.2-0ubuntu1
* New upstream release
  - Python3 support for HPLIP
  - Doesn't build against libjpeg-turbo 1.3.90 (LP: #1388126)
  - hpcups crashes if DEVICE_URI not set in environment (LP: #1395676)
  - Incorrect call to hpmudext.device_open (LP: #1388007)
  - plugin download fails if python links to python3 (LP: #1187055)
  - Incorrect IEEE 1284 Device IDs for many models (LP: #802999)
* debian/patches/85_rebuild_python_ui.dpatch: Manually updated to apply to new
  upstream source code.
* debian/patches/hp_photosmart_pro_b9100_support.dpatch,
  debian/patches/simple-scan-as-default.dpatch,
  debian/patches/hpfax-bug-function-used-before-importing-log.dpatch,
  debian/patches/hp-systray-make-menu-title-visible-in-sni-qt-indicator.dpatch,
  debian/patches/hp-systray-make-menu-appear-in-sni-qt-indicator-with-kde.dpatch,
  debian/patches/hpaio-option-duplex.diff,
  debian/patches/musb-c-do-not-crash-on-usb-failure.patch,
  debian/patches/process-events-for-systray.patch: Refreshed with quilt.
* debian/rules: Force Python3 build using PYTHON=python3 ./configure option
* debian/rules: Use py3versions to get system's Python3 interpreter version
* debian/rules: Use relative symlink for /usr/sbin/hpssd, so that shebang
  correction works.
* debian/rules: Make sure that the Python interpreter paths in all executables
  use python3.
* debian/rules: Use dh_python3 instead of dh_python2.
* debian/control: Replaced all Python-related dependencies by their
  Python3 equivalent.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import os
29
29
 
30
30
# Local
31
 
from base.g import *
32
 
from base import utils, tui
 
31
from .g import *
 
32
from . import utils, tui
33
33
from base import password, validation
34
34
from base.codes import *
35
35
from base.strings import *
40
40
 
41
41
 
42
42
 
43
 
 
44
43
########### methods ###########
45
44
 
46
45
 
138
137
        log.error("Internet connection not found.")
139
138
    else:
140
139
        sts, HPLIP_file = utils.download_from_network(HPLIP_INFO_SITE)
141
 
        if sts is True:
 
140
        if sts == 0:
142
141
            hplip_si_conf = ConfigBase(HPLIP_file)
143
142
            url = hplip_si_conf.get("SMART_INSTALL","reference","")
144
143
            if url:
159
158
    if req_checksum and req_checksum != calc_checksum:
160
159
        return ERROR_FILE_CHECKSUM, queryString(ERROR_CHECKSUM_ERROR, 0, plugin_file)
161
160
 
162
 
 
163
 
    #Validate Digital signatures
 
161
    #Validate Digital Signature
164
162
    gpg_obj = validation.GPG_Verification()
165
163
    digsig_sts, error_str = gpg_obj.validate(smart_install_run, smart_install_asc)
166
164
 
167
165
    return digsig_sts, smart_install_run, smart_install_asc, error_str
168
166
 
 
167
 
 
168
 
169
169
def download(mode, passwordObj):
170
170
    if not utils.check_network_connection():
171
171
        log.error("Internet connection not found.")
173
173
 
174
174
    else:
175
175
        sts, HPLIP_file = utils.download_from_network(HPLIP_INFO_SITE)
176
 
        if sts is True:
 
176
        if sts == 0:
177
177
            hplip_si_conf = ConfigBase(HPLIP_file)
178
178
            source = hplip_si_conf.get("SMART_INSTALL","url","")
179
179
            if not source:
181
181
                return ERROR_FAILED_TO_DOWNLOAD_FILE, "" , "", queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, HPLIP_INFO_SITE)
182
182
 
183
183
        sts, smart_install_run = utils.download_from_network(source)
184
 
        if not sts:
 
184
        if sts:
185
185
            log.error("Failed to download %s."%source)
186
186
            return ERROR_FAILED_TO_DOWNLOAD_FILE, "" , "", queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source)
187
187
 
188
188
        sts, smart_install_asc = utils.download_from_network(source+'.asc')
189
 
        if not sts:
 
189
        if sts:
190
190
            log.error("Failed to download %s."%(source+'.asc'))
191
191
            return ERROR_FAILED_TO_DOWNLOAD_FILE, "" , "", queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source + ".asc")
192
192
 
252
252
 
253
253
            else:
254
254
                sts, smart_install_run, smart_install_asc, error_str = download(mode, passwordObj)
 
255
 
255
256
                disable_si = False
256
257
                return_val = sts
 
258
 
257
259
                if sts == ERROR_SUCCESS:
258
260
                    disable_si = True
 
261
 
259
262
                elif sts in (ERROR_UNABLE_TO_RECV_KEYS, ERROR_DIGITAL_SIGN_NOT_FOUND):
260
263
                    response, value = tui.enter_yes_no("Digital Sign verification failed, Do you want to continue?")
261
264
                    if not response or not value: