[Python-modules-commits] [python-gammu] 01/03: New upstream version 2.7
Michal Cihar
nijel at moszumanska.debian.org
Sun Oct 23 13:13:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
nijel pushed a commit to branch master
in repository python-gammu.
commit 19f5a0d9a9efe4a63602f1536a6188bbc9ac6f69
Author: Michal Čihař <michal at cihar.com>
Date: Sun Oct 23 15:12:30 2016 +0200
New upstream version 2.7
---
NEWS.rst | 5 ++
PKG-INFO | 5 +-
README.rst | 3 -
gammu/src/gammu.c | 9 ++-
python_gammu.egg-info/PKG-INFO | 5 +-
python_gammu.egg-info/SOURCES.txt | 1 +
setup.py | 4 +-
test/data/sqlite-16.sql | 135 ++++++++++++++++++++++++++++++++++++++
test/test_dummy.py | 41 ++++++++++--
test/test_smsd.py | 4 +-
test/test_worker.py | 14 ++++
11 files changed, 205 insertions(+), 21 deletions(-)
diff --git a/NEWS.rst b/NEWS.rst
index 0dc97e3..abac153 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,8 @@
+2.7
+===
+
+* Needs Gammu >= 1.37.90 due to API changes.
+
2.6
===
diff --git a/PKG-INFO b/PKG-INFO
index d6638ec..e088f18 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-gammu
-Version: 2.6
+Version: 2.7
Summary: Gammu bindings
Home-page: http://wammu.eu/python-gammu/
Author: Michal Čihař
@@ -43,9 +43,6 @@ Description: python-gammu
:alt: PyPI
:target: https://pypi.python.org/pypi/python-gammu/
- .. image:: https://todofy.org/b/gammu/python-gammu
- :target: https://todofy.org/r/gammu/python-gammu
-
Python bindings for Gammu library.
Homepage
diff --git a/README.rst b/README.rst
index 5479725..8302137 100644
--- a/README.rst
+++ b/README.rst
@@ -34,9 +34,6 @@ python-gammu
:alt: PyPI
:target: https://pypi.python.org/pypi/python-gammu/
-.. image:: https://todofy.org/b/gammu/python-gammu
- :target: https://todofy.org/r/gammu/python-gammu
-
Python bindings for Gammu library.
Homepage
diff --git a/gammu/src/gammu.c b/gammu/src/gammu.c
index 57a39c4..f5bcccc 100644
--- a/gammu/src/gammu.c
+++ b/gammu/src/gammu.c
@@ -4750,7 +4750,8 @@ StateMachine_GetFilePart(StateMachineObject *self, PyObject *args, PyObject *kwd
static char *kwlist[] = {"File", NULL};
PyObject *value, *result;
GSM_File File;
- int handle, size;
+ int handle;
+ size_t size;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", kwlist,
&PyDict_Type, &(value)))
@@ -4825,7 +4826,8 @@ StateMachine_AddFilePart(StateMachineObject *self, PyObject *args, PyObject *kwd
static char *kwlist[] = {"File", NULL};
PyObject *value, *result;
GSM_File File;
- int handle, pos;
+ int handle;
+ size_t pos;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", kwlist,
&PyDict_Type, &(value)))
@@ -4900,7 +4902,8 @@ StateMachine_SendFilePart(StateMachineObject *self, PyObject *args, PyObject *kw
static char *kwlist[] = {"File", NULL};
PyObject *value, *result;
GSM_File File;
- int handle, pos;
+ int handle;
+ size_t pos;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", kwlist,
&PyDict_Type, &(value)))
diff --git a/python_gammu.egg-info/PKG-INFO b/python_gammu.egg-info/PKG-INFO
index d6638ec..e088f18 100644
--- a/python_gammu.egg-info/PKG-INFO
+++ b/python_gammu.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-gammu
-Version: 2.6
+Version: 2.7
Summary: Gammu bindings
Home-page: http://wammu.eu/python-gammu/
Author: Michal Čihař
@@ -43,9 +43,6 @@ Description: python-gammu
:alt: PyPI
:target: https://pypi.python.org/pypi/python-gammu/
- .. image:: https://todofy.org/b/gammu/python-gammu
- :target: https://todofy.org/r/gammu/python-gammu
-
Python bindings for Gammu library.
Homepage
diff --git a/python_gammu.egg-info/SOURCES.txt b/python_gammu.egg-info/SOURCES.txt
index 44c5b90..f19bfce 100644
--- a/python_gammu.egg-info/SOURCES.txt
+++ b/python_gammu.egg-info/SOURCES.txt
@@ -88,6 +88,7 @@ test/data/k770.vcs
test/data/rrule.ics
test/data/sqlite-14.sql
test/data/sqlite-15.sql
+test/data/sqlite-16.sql
test/data/gammu-dummy/calendar/2
test/data/gammu-dummy/calendar/22
test/data/gammu-dummy/fs/file5
diff --git a/setup.py b/setup.py
index 50d6667..b305c6d 100755
--- a/setup.py
+++ b/setup.py
@@ -30,8 +30,8 @@ import os
import codecs
# some defines
-VERSION = '2.6'
-GAMMU_REQUIRED = '1.34.0'
+VERSION = '2.7'
+GAMMU_REQUIRED = '1.37.90'
README_FILE = os.path.join(os.path.dirname(__file__), 'README.rst')
with codecs.open(README_FILE, 'r', 'utf-8') as readme:
README = readme.read()
diff --git a/test/data/sqlite-16.sql b/test/data/sqlite-16.sql
new file mode 100644
index 0000000..f7c5915
--- /dev/null
+++ b/test/data/sqlite-16.sql
@@ -0,0 +1,135 @@
+CREATE TABLE gammu (
+ Version INTEGER NOT NULL DEFAULT '0' PRIMARY KEY
+);
+
+INSERT INTO gammu (Version) VALUES (16);
+
+CREATE TABLE inbox (
+ UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ ReceivingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),
+ Text TEXT NOT NULL,
+ SenderNumber TEXT NOT NULL DEFAULT '',
+ Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',
+ UDH TEXT NOT NULL,
+ SMSCNumber TEXT NOT NULL DEFAULT '',
+ Class INTEGER NOT NULL DEFAULT '-1',
+ TextDecoded TEXT NOT NULL DEFAULT '',
+ ID INTEGER PRIMARY KEY AUTOINCREMENT,
+ RecipientID TEXT NOT NULL,
+ Processed TEXT NOT NULL DEFAULT 'false',
+ CHECK (Coding IN
+ ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression'))
+);
+
+CREATE TRIGGER update_inbox_time UPDATE ON inbox
+ BEGIN
+ UPDATE inbox SET UpdatedInDB = datetime('now') WHERE ID = old.ID;
+ END;
+
+CREATE TABLE outbox (
+ UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ SendingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),
+ SendBefore time NOT NULL DEFAULT '23:59:59',
+ SendAfter time NOT NULL DEFAULT '00:00:00',
+ Text TEXT,
+ DestinationNumber TEXT NOT NULL DEFAULT '',
+ Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',
+ UDH TEXT,
+ Class INTEGER DEFAULT '-1',
+ TextDecoded TEXT NOT NULL DEFAULT '',
+ ID INTEGER PRIMARY KEY AUTOINCREMENT,
+ MultiPart TEXT NOT NULL DEFAULT 'false',
+ RelativeValidity INTEGER DEFAULT '-1',
+ SenderID TEXT,
+ SendingTimeOut NUMERIC NOT NULL DEFAULT (datetime('now')),
+ DeliveryReport TEXT DEFAULT 'default',
+ CreatorID TEXT NOT NULL,
+ Retries INTEGER DEFAULT '0',
+ Priority INTEGER DEFAULT '0',
+ CHECK (Coding IN
+ ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),
+ CHECK (DeliveryReport IN ('default','yes','no'))
+);
+
+CREATE INDEX outbox_date ON outbox(SendingDateTime, SendingTimeOut);
+CREATE INDEX outbox_sender ON outbox(SenderID);
+
+CREATE TRIGGER update_outbox_time UPDATE ON outbox
+ BEGIN
+ UPDATE outbox SET UpdatedInDB = datetime('now') WHERE ID = old.ID;
+ END;
+
+CREATE TABLE outbox_multipart (
+ Text TEXT,
+ Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',
+ UDH TEXT,
+ Class INTEGER DEFAULT '-1',
+ TextDecoded TEXT DEFAULT NULL,
+ ID INTEGER,
+ SequencePosition INTEGER NOT NULL DEFAULT '1',
+ CHECK (Coding IN
+ ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')),
+ PRIMARY KEY (ID, SequencePosition)
+);
+
+CREATE TABLE phones (
+ ID TEXT NOT NULL,
+ UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ TimeOut NUMERIC NOT NULL DEFAULT (datetime('now')),
+ Send TEXT NOT NULL DEFAULT 'no',
+ Receive TEXT NOT NULL DEFAULT 'no',
+ IMEI TEXT PRIMARY KEY NOT NULL,
+ IMSI TEXT NOT NULL,
+ NetCode TEXT DEFAULT 'ERROR',
+ NetName TEXT DEFAULT 'ERROR',
+ Client TEXT NOT NULL,
+ Battery INTEGER NOT NULL DEFAULT -1,
+ Signal INTEGER NOT NULL DEFAULT -1,
+ Sent INTEGER NOT NULL DEFAULT 0,
+ Received INTEGER NOT NULL DEFAULT 0
+);
+
+CREATE TRIGGER update_phones_time UPDATE ON phones
+ BEGIN
+ UPDATE phones SET UpdatedInDB = datetime('now') WHERE IMEI = old.IMEI;
+ END;
+
+CREATE TABLE sentitems (
+ UpdatedInDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ InsertIntoDB NUMERIC NOT NULL DEFAULT (datetime('now')),
+ SendingDateTime NUMERIC NOT NULL DEFAULT (datetime('now')),
+ DeliveryDateTime NUMERIC NULL,
+ Text TEXT NOT NULL,
+ DestinationNumber TEXT NOT NULL DEFAULT '',
+ Coding TEXT NOT NULL DEFAULT 'Default_No_Compression',
+ UDH TEXT NOT NULL,
+ SMSCNumber TEXT NOT NULL DEFAULT '',
+ Class INTEGER NOT NULL DEFAULT '-1',
+ TextDecoded TEXT NOT NULL DEFAULT '',
+ ID INTEGER,
+ SenderID TEXT NOT NULL,
+ SequencePosition INTEGER NOT NULL DEFAULT '1',
+ Status TEXT NOT NULL DEFAULT 'SendingOK',
+ StatusError INTEGER NOT NULL DEFAULT '-1',
+ TPMR INTEGER NOT NULL DEFAULT '-1',
+ RelativeValidity INTEGER NOT NULL DEFAULT '-1',
+ CreatorID TEXT NOT NULL,
+ CHECK (Status IN
+ ('SendingOK','SendingOKNoReport','SendingError','DeliveryOK','DeliveryFailed','DeliveryPending',
+ 'DeliveryUnknown','Error')),
+ CHECK (Coding IN
+ ('Default_No_Compression','Unicode_No_Compression','8bit','Default_Compression','Unicode_Compression')) ,
+ PRIMARY KEY (ID, SequencePosition)
+);
+
+CREATE INDEX sentitems_date ON sentitems(DeliveryDateTime);
+CREATE INDEX sentitems_tpmr ON sentitems(TPMR);
+CREATE INDEX sentitems_dest ON sentitems(DestinationNumber);
+CREATE INDEX sentitems_sender ON sentitems(SenderID);
+
+CREATE TRIGGER update_sentitems_time UPDATE ON sentitems
+ BEGIN
+ UPDATE sentitems SET UpdatedInDB = datetime('now') WHERE ID = old.ID;
+ END;
diff --git a/test/test_dummy.py b/test/test_dummy.py
index 11d7cf6..90a5de8 100644
--- a/test/test_dummy.py
+++ b/test/test_dummy.py
@@ -54,12 +54,14 @@ dbdir = {path}
class DummyTest(unittest.TestCase):
test_dir = None
config_name = None
+ dummy_dir = None
+ _called = False
def setUp(self):
self.test_dir = tempfile.mkdtemp()
- dummy_dir = os.path.join(self.test_dir, 'gammu-dummy')
+ self.dummy_dir = os.path.join(self.test_dir, 'gammu-dummy')
self.config_name = os.path.join(self.test_dir, '.gammurc')
- shutil.copytree(DUMMY_DIR, dummy_dir)
+ shutil.copytree(DUMMY_DIR, self.dummy_dir)
with open(self.config_name, 'w') as handle:
handle.write(CONFIGURATION.format(path=self.test_dir))
@@ -72,10 +74,30 @@ class DummyTest(unittest.TestCase):
state_machine.Init()
return state_machine
+ def fake_incoming_call(self):
+ """Fake incoming call"""
+ filename = os.path.join(self.dummy_dir, 'incoming-call')
+ with open(filename, 'w') as handle:
+ handle.write('\n')
+
+ def check_incoming_call(self):
+ """Checks whether incoming call faking is supported"""
+ current = tuple([int(x) for x in gammu.Version()[2].split('.')])
+ if current < (1, 37, 91):
+ raise unittest.SkipTest(
+ 'Not supported in version {0}'.format(gammu.Version()[2])
+ )
+
+ def call_callback(self, state_machine, response, data):
+ '''
+ Callback on USSD data.
+ '''
+ self._called = True
+ self.assertEqual(response, 'Call')
+ self.assertEqual(data['Number'], '+800123456')
-class BasicDummyTest(DummyTest):
- _called = False
+class BasicDummyTest(DummyTest):
def test_model(self):
state_machine = self.get_statemachine()
self.assertEqual(state_machine.GetModel()[1], 'Dummy')
@@ -380,3 +402,14 @@ class BasicDummyTest(DummyTest):
break
self.assertEqual(folders, 3)
self.assertEqual(files, 6)
+
+ def test_incoming_call(self):
+ self.check_incoming_call()
+ self._called = False
+ state_machine = self.get_statemachine()
+ state_machine.SetIncomingCallback(self.call_callback)
+ state_machine.SetIncomingCall()
+ state_machine.GetSignalQuality()
+ self.fake_incoming_call()
+ state_machine.GetSignalQuality()
+ self.assertTrue(self._called)
diff --git a/test/test_smsd.py b/test/test_smsd.py
index 138b988..88d18be 100644
--- a/test/test_smsd.py
+++ b/test/test_smsd.py
@@ -52,8 +52,10 @@ def get_script():
if version < (1, 36, 7):
dbver = 14
- else:
+ elif version < (1, 37, 90):
dbver = 15
+ else:
+ dbver = 16
print('Gammu version {0}, SMSD DB version {1}'.format(version, dbver))
diff --git a/test/test_worker.py b/test/test_worker.py
index b968dc4..87f69a7 100644
--- a/test/test_worker.py
+++ b/test/test_worker.py
@@ -303,6 +303,7 @@ class WorkerDummyTest(DummyTest):
self.results.append((name, result, error, percents))
def test_worker(self):
+ self.results = []
worker = gammu.worker.GammuWorker(self.callback)
worker.configure(self.get_statemachine().GetConfig())
# We can directly invoke commands
@@ -344,3 +345,16 @@ class WorkerDummyTest(DummyTest):
self.maxDiff = None
self.assertEqual(WORKER_EXPECT, self.results)
+
+ def test_incoming(self):
+ self.check_incoming_call()
+ self.results = []
+ self._called = False
+ worker = gammu.worker.GammuWorker(self.callback)
+ worker.configure(self.get_statemachine().GetConfig())
+ worker.initiate()
+ worker.enqueue('SetIncomingCallback', (self.call_callback, ))
+ worker.enqueue('SetIncomingCall')
+ self.fake_incoming_call()
+ worker.terminate()
+ self.assertTrue(self._called)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gammu.git
More information about the Python-modules-commits
mailing list