Cleaning up thing for 1.7.5

This commit is contained in:
Adolfo Gómez García 2015-04-26 03:18:15 +02:00
parent 1ea3261b27
commit a996562a5e
6 changed files with 66 additions and 11 deletions

View File

@ -9,12 +9,12 @@ dpkg-buildpackage -b
top=`pwd`
cat udsclient-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"version 0.0.0"/"version ${VERSION}"/g |
sed -e s/"release 1"/"release ${RELEASE}"/g > udsclient-$VERSION.spec
# Now fix dependencies for opensuse
cat udsclient-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"version 0.0.0"/"version ${VERSION}"/g |
sed -e s/"name udsclient"/"name udsclient-opensuse"/g |
sed -e s/"PyQt4"/"python-qt4"/g |
sed -e s/"libXScrnSaver"/"libXss1"/g > udsclient-opensuse-$VERSION.spec

View File

@ -1,6 +1,6 @@
%define _topdir %(echo $PWD)/rpm
%define name udsclient
%define version 1.7.0
%define version 0.0.0
%define release 1
%define buildroot %{_topdir}/%{name}-%{version}-%{release}-root

View File

@ -39,15 +39,12 @@ import six
from uds.rest import RestRequest
from uds.forward import forward
from uds import tools
from uds import VERSION
import webbrowser
import time
from UDSWindow import Ui_MainWindow
# Client connector version
VERSION = '1.7.5'
class UDSClient(QtGui.QMainWindow):
@ -115,7 +112,7 @@ class UDSClient(QtGui.QMainWindow):
self.closeWindow()
return
self.req = RestRequest('/{}/{}'.format(self.ticket, self.scrambler), self, self.transportDataReceived)
self.req = RestRequest('/{}/{}'.format(self.ticket, self.scrambler), self, self.transportDataReceived, params={'hostname': tools.getHostName()})
self.req.get()
except Exception as e:

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
# On centos, old six release does not includes byte2int, nor six.PY2
import six
VERSION = '1.7.5'
__title__ = 'udclient'
__version__ = VERSION
__build__ = 0x010750
__author__ = 'Adolfo Gómez'
__license__ = "BSD 3-clause"
__copyright__ = "Copyright 2014-205 VirtualCable S.L.U."

View File

@ -37,10 +37,12 @@ from PyQt4.QtCore import QObject, QUrl, QSettings
from PyQt4.QtCore import Qt
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply, QSslCertificate
from PyQt4.QtGui import QMessageBox
from . import VERSION
import json
import osDetector
import six
import urllib
class RestRequest(QObject):
@ -49,10 +51,13 @@ class RestRequest(QObject):
done = pyqtSignal(dict, name='done')
def __init__(self, url, parentWindow, done): # parent not used
def __init__(self, url, parentWindow, done, params=None): # parent not used
super(RestRequest, self).__init__()
# private
self._manager = QNetworkAccessManager()
if params is not None:
url += '?' + '&'.join('{}={}'.format(k, urllib.quote(six.text_type(v))) for k, v in params.iteritems())
self.url = QUrl(RestRequest.restApiUrl + url)
# connect asynchronous result, when a request finishes
@ -104,5 +109,5 @@ class RestRequest(QObject):
def get(self):
request = QNetworkRequest(self.url)
request.setRawHeader('User-Agent', osDetector.getOs() + " - UDS Connector")
request.setRawHeader('User-Agent', osDetector.getOs() + " - UDS Connector " + VERSION)
self._manager.get(request)

View File

@ -36,8 +36,9 @@ import tempfile
import string
import random
import os
import sys
import socket
import stat
import six
_unlinkFiles = []
_tasksToWait = []
@ -67,8 +68,16 @@ def findApp(appName, extraPath=None):
return None
def getHostName():
'''
Returns current host name
In fact, it's a wrapper for socket.gethostname()
'''
return six.text_type(socket.gethostname())
# Queing operations (to be executed before exit)
def addFileToUnlink(filename):
'''
Adds a file to the wait-and-unlink list