[Python-modules-commits] [python-gammu] 02/06: New upstream version 2.9
Michal Cihar
nijel at moszumanska.debian.org
Mon Jul 10 18:43:21 UTC 2017
This is an automated email from the git hooks/post-receive script.
nijel pushed a commit to branch master
in repository python-gammu.
commit 4b5161cbd637ae29c56ad093f5bad15e50b04328
Author: Michal Čihař <michal at cihar.com>
Date: Mon Jul 10 20:17:10 2017 +0200
New upstream version 2.9
---
NEWS.rst | 11 +++
PKG-INFO | 41 +++++++---
README.rst | 31 ++++---
examples/__init__.py | 4 +-
examples/addcontacts.py | 6 +-
examples/addfile.py | 4 +-
examples/backup_convertor.py | 4 +-
examples/batteryinfo.py | 6 +-
examples/debugging.py | 12 +--
examples/dialvoice.py | 4 +-
examples/doc-exceptions.py | 4 +-
examples/dummy_phone.py | 44 +++++-----
examples/filesystem_test.py | 72 ++++++++---------
examples/getallcalendar.py | 10 +--
examples/getallmemory.py | 8 +-
examples/getallmemory_nonext.py | 8 +-
examples/getallsms.py | 12 +--
examples/getallsms_decode.py | 20 ++---
examples/getalltodo.py | 10 +--
examples/getdiverts.py | 4 +-
examples/incoming.py | 8 +-
examples/listfilesystem.py | 42 +++++-----
examples/mass_sms.py | 6 +-
examples/pdu_decoder.py | 4 +-
examples/read_sms_backup.py | 20 ++---
examples/savesmspercontact.py | 4 +-
examples/sendlongsms.py | 4 +-
examples/sendsms.py | 4 +-
examples/service_numbers.py | 8 +-
examples/setdiverts.py | 4 +-
examples/sms_replier.py | 10 +--
examples/smsbackup.py | 4 +-
examples/smsd_inject.py | 4 +-
examples/smsd_state.py | 4 +-
examples/vcs.py | 4 +-
examples/worker.py | 6 +-
gammu/__init__.py | 4 +-
gammu/data.py | 4 +-
gammu/exception.py | 4 +-
gammu/smsd.py | 4 +-
gammu/src/convertors/backup.c | 2 +-
gammu/src/convertors/base.c | 9 ++-
gammu/src/convertors/bitmap.c | 2 +-
gammu/src/convertors/calendar.c | 2 +-
gammu/src/convertors/call.c | 2 +-
gammu/src/convertors/diverts.c | 2 +-
gammu/src/convertors/file.c | 2 +-
gammu/src/convertors/memory.c | 2 +-
gammu/src/convertors/misc.c | 2 +-
gammu/src/convertors/ringtone.c | 2 +-
gammu/src/convertors/sms.c | 2 +-
gammu/src/convertors/string.c | 64 +++++++++++----
gammu/src/convertors/time.c | 2 +-
gammu/src/convertors/todo.c | 2 +-
gammu/src/convertors/wap.c | 2 +-
gammu/src/data.c | 2 +-
gammu/src/errors.c | 2 +-
gammu/src/gammu.c | 32 ++++----
gammu/src/misc.c | 7 +-
gammu/src/smsd.c | 4 +-
gammu/worker.py | 10 +--
include/convertors.h | 4 +-
include/data.h | 2 +-
include/errors.h | 2 +-
include/misc.h | 15 +++-
python_gammu.egg-info/PKG-INFO | 41 +++++++---
setup.cfg | 1 -
setup.py | 175 ++++++++++++++++++++++++++++++----------
test/__init__.py | 4 +-
test/test_backup.py | 19 +++--
test/test_config.py | 32 +++++---
test/test_data.py | 4 +-
test/test_dummy.py | 29 ++++++-
test/test_errors.py | 4 +-
test/test_sms.py | 4 +-
test/test_smsd.py | 16 ++--
test/test_worker.py | 4 +-
77 files changed, 613 insertions(+), 366 deletions(-)
diff --git a/NEWS.rst b/NEWS.rst
index abac153..9548e39 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,14 @@
+2.9
+===
+
+* Fixed compilation under Windows.
+
+2.8
+===
+
+* Make parameters to CancelCall and AnswerCall optional.
+* Added support for UTF-16 Unicode chars (emojis).
+
2.7
===
diff --git a/PKG-INFO b/PKG-INFO
index e088f18..2a844f4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,18 +1,21 @@
Metadata-Version: 1.1
Name: python-gammu
-Version: 2.7
+Version: 2.9
Summary: Gammu bindings
-Home-page: http://wammu.eu/python-gammu/
-Author: Michal Čihař
+Home-page: https://wammu.eu/python-gammu/
+Author: Michal Cihar
Author-email: michal at cihar.com
License: GPLv2+
-Download-URL: http://wammu.eu/download/python-gammu/source/
+Download-URL: https://wammu.eu/download/python-gammu/
Description: python-gammu
============
.. image:: https://travis-ci.org/gammu/python-gammu.svg?branch=master
:target: https://travis-ci.org/gammu/python-gammu
+ .. image:: https://ci.appveyor.com/api/projects/status/19cefdo79bqrtq8l?svg=true
+ :target: https://ci.appveyor.com/project/nijel/python-gammu
+
.. image:: https://www.codacy.com/project/badge/c7e87df480fb4609aa48482873f5c46b
:target: https://www.codacy.com/public/nijel/python-gammu
@@ -25,9 +28,6 @@ Description: python-gammu
.. image:: https://coveralls.io/repos/gammu/python-gammu/badge.svg
:target: https://coveralls.io/r/gammu/python-gammu
- .. image:: https://buildtimetrend.herokuapp.com/badge/gammu/python-gammu/latest
- :target: https://buildtimetrend.herokuapp.com/dashboard/gammu/python-gammu
-
.. image:: https://scan.coverity.com/projects/4837/badge.svg
:target: https://scan.coverity.com/projects/4837
@@ -48,12 +48,12 @@ Description: python-gammu
Homepage
========
- <http://wammu.eu/python-gammu/>
+ <https://wammu.eu/python-gammu/>
License
=======
- Copyright (C) 2003 - 2016 Michal Čihař
+ Copyright (C) 2003 - 2017 Michal Cihar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -86,8 +86,21 @@ Description: python-gammu
============
To compile python-gammu, you need Gammu development files (usually shipped as
- ``libgammu-dev`` or ``gammu-devel`` in Linux distributions) and pkg-config,
- which is used to discover location of dependencies.
+ ``libgammu-dev`` or ``gammu-devel`` in Linux distributions).
+
+ The location of the libraries is discovered using ``pkg-config``,
+ ``GAMMU_PATH`` environment variable and falls back to generic locations. In
+ case it does not work, either install ``pkg-config`` or set ``GAMMU_PATH``.
+
+ On Linux something like this should work::
+
+ GAMMU_PATH=/opt/gammu python setup.py build
+
+ On Windows::
+
+ SET GAMMU_PATH="C:\Gammu"
+ python setup.py build
+
Documentation
=============
@@ -98,12 +111,12 @@ Description: python-gammu
>>> help(gammu)
Alternatively you can use Sphinx to generate browsable version, which is
- also available on-line at <http://wammu.eu/docs/manual/>.
+ also available on-line at <https://wammu.eu/docs/manual/>.
Feedback and bug reports
========================
- Any feedback is welcome, see <http://wammu.eu/support/> for information
+ Any feedback is welcome, see <https://wammu.eu/support/> for information
how to contact developers.
Keywords: mobile,phone,SMS,contact,gammu,calendar,todo
@@ -127,6 +140,8 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Communications :: Telephony
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Hardware
diff --git a/README.rst b/README.rst
index 8302137..4cab199 100644
--- a/README.rst
+++ b/README.rst
@@ -4,6 +4,9 @@ python-gammu
.. image:: https://travis-ci.org/gammu/python-gammu.svg?branch=master
:target: https://travis-ci.org/gammu/python-gammu
+.. image:: https://ci.appveyor.com/api/projects/status/19cefdo79bqrtq8l?svg=true
+ :target: https://ci.appveyor.com/project/nijel/python-gammu
+
.. image:: https://www.codacy.com/project/badge/c7e87df480fb4609aa48482873f5c46b
:target: https://www.codacy.com/public/nijel/python-gammu
@@ -16,9 +19,6 @@ python-gammu
.. image:: https://coveralls.io/repos/gammu/python-gammu/badge.svg
:target: https://coveralls.io/r/gammu/python-gammu
-.. image:: https://buildtimetrend.herokuapp.com/badge/gammu/python-gammu/latest
- :target: https://buildtimetrend.herokuapp.com/dashboard/gammu/python-gammu
-
.. image:: https://scan.coverity.com/projects/4837/badge.svg
:target: https://scan.coverity.com/projects/4837
@@ -39,12 +39,12 @@ Python bindings for Gammu library.
Homepage
========
-<http://wammu.eu/python-gammu/>
+<https://wammu.eu/python-gammu/>
License
=======
-Copyright (C) 2003 - 2016 Michal Čihař
+Copyright (C) 2003 - 2017 Michal Cihar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,8 +77,21 @@ Requirements
============
To compile python-gammu, you need Gammu development files (usually shipped as
-``libgammu-dev`` or ``gammu-devel`` in Linux distributions) and pkg-config,
-which is used to discover location of dependencies.
+``libgammu-dev`` or ``gammu-devel`` in Linux distributions).
+
+The location of the libraries is discovered using ``pkg-config``,
+``GAMMU_PATH`` environment variable and falls back to generic locations. In
+case it does not work, either install ``pkg-config`` or set ``GAMMU_PATH``.
+
+On Linux something like this should work::
+
+ GAMMU_PATH=/opt/gammu python setup.py build
+
+On Windows::
+
+ SET GAMMU_PATH="C:\Gammu"
+ python setup.py build
+
Documentation
=============
@@ -89,10 +102,10 @@ Please see included python documentation::
>>> help(gammu)
Alternatively you can use Sphinx to generate browsable version, which is
-also available on-line at <http://wammu.eu/docs/manual/>.
+also available on-line at <https://wammu.eu/docs/manual/>.
Feedback and bug reports
========================
-Any feedback is welcome, see <http://wammu.eu/support/> for information
+Any feedback is welcome, see <https://wammu.eu/support/> for information
how to contact developers.
diff --git a/examples/__init__.py b/examples/__init__.py
index 005ba7b..7006187 100644
--- a/examples/__init__.py
+++ b/examples/__init__.py
@@ -1,9 +1,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/addcontacts.py b/examples/addcontacts.py
index 0f6ac46..1a8eb66 100755
--- a/examples/addcontacts.py
+++ b/examples/addcontacts.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ def main():
for item in backup['PhonePhonebook']:
item['MemoryType'] = memory
loc = state_machine.AddMemory(item)
- print(('Added item to location %d' % loc))
+ print(('Added item to location {0:d}'.format(loc)))
if __name__ == '__main__':
diff --git a/examples/addfile.py b/examples/addfile.py
index 702e7a9..60980dc 100755
--- a/examples/addfile.py
+++ b/examples/addfile.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/backup_convertor.py b/examples/backup_convertor.py
index d3c0804..5d2c4cd 100755
--- a/examples/backup_convertor.py
+++ b/examples/backup_convertor.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/batteryinfo.py b/examples/batteryinfo.py
index 0b6aeff..dce5408 100755
--- a/examples/batteryinfo.py
+++ b/examples/batteryinfo.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,4 +37,4 @@ status = state_machine.GetBatteryCharge()
for x in status:
if status[x] != -1:
- print(("%20s: %s" % (x, status[x])))
+ print(("{0:20}: {1}".format(x, status[x])))
diff --git a/examples/debugging.py b/examples/debugging.py
index eac5b38..4dc9592 100755
--- a/examples/debugging.py
+++ b/examples/debugging.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@ def main():
imei = state_machine.GetIMEI()
firmware = state_machine.GetFirmware()
print('Phone infomation:')
- print(('%-15s: %s' % ('Manufacturer', manufacturer)))
- print(('%-15s: %s (%s)' % ('Model', model[0], model[1])))
- print(('%-15s: %s' % ('IMEI', imei)))
- print(('%-15s: %s' % ('Firmware', firmware[0])))
+ print(('{0:<15}: {1}'.format('Manufacturer', manufacturer)))
+ print(('{0:<15}: {1} ({2})'.format('Model', model[0], model[1])))
+ print(('{0:<15}: {1}'.format('IMEI', imei)))
+ print(('{0:<15}: {1}'.format('Firmware', firmware[0])))
if __name__ == '__main__':
diff --git a/examples/dialvoice.py b/examples/dialvoice.py
index fd05029..8fec160 100755
--- a/examples/dialvoice.py
+++ b/examples/dialvoice.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/doc-exceptions.py b/examples/doc-exceptions.py
index ea36528..3e16b52 100755
--- a/examples/doc-exceptions.py
+++ b/examples/doc-exceptions.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/dummy_phone.py b/examples/dummy_phone.py
index 090af92..08fce57 100755
--- a/examples/dummy_phone.py
+++ b/examples/dummy_phone.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,13 +48,13 @@ def get_all_memory(state_machine, memory_type):
remain = remain - 1
print()
- print(('%-15s: %d' % ('Location', entry['Location'])))
+ print(('{0:<15}: {1:d}'.format('Location', entry['Location'])))
for v in entry['Entries']:
if v['Type'] in ('Photo'):
- print(('%-15s: %s...' % (v['Type'], repr(v['Value'])[:30])))
+ print(('{0:<15}: {1}...'.format(v['Type'], repr(v['Value'])[:30])))
else:
print((
- '%-15s: %s' % (v['Type'], str(v['Value']).encode('utf-8'))
+ '{0:<15}: {1}'.format(v['Type'], str(v['Value']).encode('utf-8'))
))
@@ -74,10 +74,10 @@ def get_all_calendar(state_machine):
remain = remain - 1
print()
- print(('%-20s: %d' % ('Location', entry['Location'])))
- print(('%-20s: %s' % ('Type', entry['Type'])))
+ print(('{0:<20}: {1:d}'.format('Location', entry['Location'])))
+ print(('{0:<20}: {1}'.format('Type', entry['Type'])))
for v in entry['Entries']:
- print(('%-20s: %s' % (v['Type'], str(v['Value']).encode('utf-8'))))
+ print(('{0:<20}: {1}'.format(v['Type'], str(v['Value']).encode('utf-8'))))
def get_battery_status(state_machine):
@@ -85,7 +85,7 @@ def get_battery_status(state_machine):
for x in status:
if status[x] != -1:
- print(("%20s: %s" % (x, status[x])))
+ print(("{0:20}: {1}".format(x, status[x])))
def get_all_sms(state_machine):
@@ -110,22 +110,22 @@ def get_all_sms(state_machine):
def print_sms_header(message, folders):
print()
- print('%-15s: %s' % ('Number', message['Number'].encode('utf-8')))
- print('%-15s: %s' % ('Date', str(message['DateTime'])))
- print('%-15s: %s' % ('State', message['State']))
- print('%-15s: %s %s (%d)' % (
+ print('{0:<15}: {1}'.format('Number', message['Number'].encode('utf-8')))
+ print('{0:<15}: {1}'.format('Date', str(message['DateTime'])))
+ print('{0:<15}: {1}'.format('State', message['State']))
+ print('{0:<15}: {1} {2} ({3:d})'.format(
'Folder',
folders[message['Folder']]['Name'].encode('utf-8'),
folders[message['Folder']]['Memory'].encode('utf-8'),
message['Folder']
))
- print('%-15s: %s' % ('Validity', message['SMSC']['Validity']))
+ print('{0:<15}: {1}'.format('Validity', message['SMSC']['Validity']))
def print_all_sms(sms, folders):
for m in sms:
print_sms_header(m, folders)
- print('\n%s' % m['Text'].encode('utf-8'))
+ print('\n{0}'.format(m['Text'].encode('utf-8')))
def link_all_sms(sms, folders):
@@ -139,13 +139,13 @@ def link_all_sms(sms, folders):
loc = []
for m in x:
loc.append(str(m['Location']))
- print('%-15s: %s' % ('Location(s)', ', '.join(loc)))
+ print('{0:<15}: {1}'.format('Location(s)', ', '.join(loc)))
if v is None:
- print('\n%s' % m['Text'].encode('utf-8'))
+ print('\n{0}'.format(m['Text'].encode('utf-8')))
else:
for e in v['Entries']:
print()
- print('%-15s: %s' % ('Type', e['ID']))
+ print('{0:<15}: {1}'.format('Type', e['ID']))
if e['Bitmap'] is not None:
for bmp in e['Bitmap']:
print('Bitmap:')
@@ -174,16 +174,16 @@ def get_all_todo(state_machine):
remain = remain - 1
print()
- print('%-15s: %d' % ('Location', entry['Location']))
- print('%-15s: %s' % ('Priority', entry['Priority']))
+ print('{0:<15}: {1:d}'.format('Location', entry['Location']))
+ print('{0:<15}: {1}'.format('Priority', entry['Priority']))
for v in entry['Entries']:
- print('%-15s: %s' % (v['Type'], str(v['Value']).encode('utf-8')))
+ print('{0:<15}: {1}'.format(v['Type'], str(v['Value']).encode('utf-8')))
def get_sms_folders(state_machine):
folders = state_machine.GetSMSFolders()
for i, folder in enumerate(folders):
- print('Folder %d: %s (%s)' % (
+ print('Folder {0:d}: {1} ({2})'.format(
i,
folder['Name'].encode('utf-8'),
folder['Memory'].encode('utf-8')
diff --git a/examples/filesystem_test.py b/examples/filesystem_test.py
index ab512c7..65f13f7 100755
--- a/examples/filesystem_test.py
+++ b/examples/filesystem_test.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Matthias Blaesing <matthias.blaesing at rwth-aachen.de>
+# Copyright © 2003 - 2017 Matthias Blaesing <matthias.blaesing at rwth-aachen.de>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,38 +49,38 @@ import gammu
import os
import datetime
import sys
-from optparse import OptionParser
+import argparse
def main():
- parser = OptionParser(usage="usage: %prog [options]")
+ parser = argparse.ArgumentParser(usage="usage: %(prog)s [options]")
- parser.add_option("-c", "--config",
- action="store", type="string",
- dest="config", default=None,
- help="Config file path")
- parser.add_option("-f", "--folder",
- action="store", type="string",
- dest="folder", default=None,
- help="Folder to be used for testing")
- parser.add_option("-t", "--test-file",
- action="store", type="string",
- dest="testfile", default="./data/cgi.jpg",
- help="Local file to be used for testing")
- (options, args) = parser.parse_args()
+ parser.add_argument("-c", "--config",
+ action="store", type=str,
+ dest="config", default=None,
+ help="Config file path")
+ parser.add_argument("-f", "--folder",
+ action="store", type=str,
+ dest="folder", default=None,
+ help="Folder to be used for testing")
+ parser.add_argument("-t", "--test-file",
+ action="store", type=str,
+ dest="testfile", default="./data/cgi.jpg",
+ help="Local file to be used for testing")
+ args = parser.parse_args()
- if options.folder is None:
+ if args.folder is None:
print("You have to select folder where testing will be done!")
print("And even better, you should read the script before you run it.")
sys.exit(1)
- if not os.path.exists(options.testfile):
+ if not os.path.exists(args.testfile):
print("You have to select file which will be used for testing!")
sys.exit(1)
state_machine = gammu.StateMachine()
- if options.config is not None:
- state_machine.ReadConfig(Filename=options.config)
+ if args.config is not None:
+ state_machine.ReadConfig(Filename=args.config)
else:
state_machine.ReadConfig()
state_machine.Init()
@@ -90,24 +90,24 @@ def main():
try:
fs_info = state_machine.GetFileSystemStatus()
fs_info["Total"] = fs_info["Free"] + fs_info["Used"]
- print("Used: %(Used)d, Free: %(Free)d, Total: %(Total)d" % fs_info)
+ print("Used: {Used:d}, Free: {Free:d}, Total: {Total:d}".format(**fs_info))
except gammu.ERR_NOTSUPPORTED:
print("You will have to live without this knowledge")
# Check DeleteFile
print("\n\nExpection: Deleting cgi.jpg from memorycard")
try:
- state_machine.DeleteFile(unicode(options.folder + "/cgi.jpg"))
+ state_machine.DeleteFile(unicode(args.folder + "/cgi.jpg"))
except gammu.ERR_FILENOTEXIST:
print("Oh well - we copy it now ;-) (You SHOULD read this)")
# Check AddFilePart
print("\n\nExpection: Put cgi.jpg onto Memorycard on phone")
- file_handle = open(options.testfile, "rb")
- file_stat = os.stat(options.testfile)
+ file_handle = open(args.testfile, "rb")
+ file_stat = os.stat(args.testfile)
ttime = datetime.datetime.fromtimestamp(file_stat[8])
file_f = {
- "ID_FullName": options.folder,
+ "ID_FullName": args.folder,
"Name": u"cgi.jpg",
"Modified": ttime,
"Folder": 0,
@@ -132,7 +132,7 @@ def main():
)
with open('./test.jpg', 'wb') as handle:
file_f = {
- "ID_FullName": options.folder + "/cgi.jpg",
+ "ID_FullName": args.folder + "/cgi.jpg",
"Finished": 0
}
while not file_f["Finished"]:
@@ -142,7 +142,7 @@ def main():
# Check correct transfer
print("\n\nExpection: test.jpg and cgi.jpg to be the same")
- f1 = open(options.testfile, "rb")
+ f1 = open(args.testfile, "rb")
f2 = open("./test.jpg", "rb")
if f1.read() == f2.read():
print("Same files")
@@ -202,15 +202,15 @@ def main():
"(readonly=1, protected=0, system=1, hidden=1)"
)
state_machine.SetFileAttributes(
- unicode(options.folder + "/cgi.jpg"), 1, 0, 1, 1
+ unicode(args.folder + "/cgi.jpg"), 1, 0, 1, 1
)
# Check GetFolderListing
print("\n\nExpection: Listing of cgi.jpg's properties")
- file_f = state_machine.GetFolderListing(unicode(options.folder), 1)
+ file_f = state_machine.GetFolderListing(unicode(args.folder), 1)
while 1:
if file_f["Name"] != "cgi.jpg":
- file_f = state_machine.GetFolderListing(unicode(options.folder), 0)
+ file_f = state_machine.GetFolderListing(unicode(args.folder), 0)
else:
attribute = ""
if file_f["Protected"]:
@@ -237,21 +237,21 @@ def main():
# Check DeleteFile
print("\n\nExpection: Deletion of cgi.jpg from memorycard")
try:
- state_machine.DeleteFile(unicode(options.folder + "cgi.jpg"))
+ state_machine.DeleteFile(unicode(args.folder + "cgi.jpg"))
print("Deleted")
except gammu.ERR_FILENOTEXIST:
print("Something is wrong ...")
# Check AddFolder
print("\n\nExpection: Creation of a folder on the memorycard \"42alpha\"")
- file_f = state_machine.AddFolder(unicode(options.folder), u"42alpha")
+ file_f = state_machine.AddFolder(unicode(args.folder), u"42alpha")
# Check GetFolderListing again *wired*
print("\n\nExpection: Print properties of newly created folder")
- file_f = state_machine.GetFolderListing(unicode(options.folder), 1)
+ file_f = state_machine.GetFolderListing(unicode(args.folder), 1)
while 1:
if file_f["Name"] != "42alpha":
- file_f = state_machine.GetFolderListing(unicode(options.folder), 0)
+ file_f = state_machine.GetFolderListing(unicode(args.folder), 0)
else:
attribute = ""
if file_f["Protected"]:
@@ -277,7 +277,7 @@ def main():
# Check DeleteFolder
print("\n\nExpection: Deletion of previously created folder \"42alpha\"")
- state_machine.DeleteFolder(unicode(options.folder + "/42alpha"))
+ state_machine.DeleteFolder(unicode(args.folder + "/42alpha"))
if __name__ == '__main__':
diff --git a/examples/getallcalendar.py b/examples/getallcalendar.py
index 077a1fe..6bf9de2 100755
--- a/examples/getallcalendar.py
+++ b/examples/getallcalendar.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ while remain > 0:
# Display it
print()
- print('%-20s: %d' % ('Location', entry['Location']))
- print('%-20s: %s' % ('Type', entry['Type']))
+ print('{0:<20}: {1:d}'.format('Location', entry['Location']))
+ print('{0:<20}: {1}'.format('Type', entry['Type']))
for v in entry['Entries']:
- print('%-20s: %s' % (v['Type'], str(v['Value'])))
+ print('{0:<20}: {1}'.format(v['Type'], str(v['Value'])))
diff --git a/examples/getallmemory.py b/examples/getallmemory.py
index 0c1a598..922fb2d 100755
--- a/examples/getallmemory.py
+++ b/examples/getallmemory.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,9 +54,9 @@ def main():
remain = remain - 1
print()
- print('%-15s: %d' % ('Location', entry['Location']))
+ print('{0:<15}: {1:d}'.format('Location', entry['Location']))
for v in entry['Entries']:
- print('%-15s: %s' % (v['Type'], str(v['Value'])))
+ print('{0:<15}: {1}'.format(v['Type'], str(v['Value'])))
if __name__ == '__main__':
diff --git a/examples/getallmemory_nonext.py b/examples/getallmemory_nonext.py
index 61597c5..c2541d2 100755
--- a/examples/getallmemory_nonext.py
+++ b/examples/getallmemory_nonext.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,9 +47,9 @@ def main():
try:
entry = state_machine.GetMemory(Type=memory_type, Location=location)
print()
- print('%-15s: %d' % ('Location', entry['Location']))
+ print('{0:<15}: {1:d}'.format('Location', entry['Location']))
for v in entry['Entries']:
- print('%-15s: %s' % (v['Type'], str(v['Value'])))
+ print('{0:<15}: {1}'.format(v['Type'], str(v['Value'])))
remain = remain - 1
except gammu.ERR_EMPTY:
pass
diff --git a/examples/getallsms.py b/examples/getallsms.py
index 301cd3f..6d86216 100755
--- a/examples/getallsms.py
+++ b/examples/getallsms.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,10 +49,10 @@ def main():
for m in sms:
print()
- print('%-15s: %s' % ('Number', m['Number']))
- print('%-15s: %s' % ('Date', str(m['DateTime'])))
- print('%-15s: %s' % ('State', m['State']))
- print('\n%s' % m['Text'])
+ print('{0:<15}: {1}'.format('Number', m['Number']))
+ print('{0:<15}: {1}'.format('Date', str(m['DateTime'])))
+ print('{0:<15}: {1}'.format('State', m['State']))
+ print('\n{0}'.format(m['Text']))
except gammu.ERR_EMPTY:
# This error is raised when we've reached last entry
# It can happen when reported status does not match real counts
diff --git a/examples/getallsms_decode.py b/examples/getallsms_decode.py
index 287eae5..3828f72 100755
--- a/examples/getallsms_decode.py
+++ b/examples/getallsms_decode.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,21 +58,21 @@ for x in data:
m = x[0]
print()
- print('%-15s: %s' % ('Number', m['Number']))
- print('%-15s: %s' % ('Date', str(m['DateTime'])))
- print('%-15s: %s' % ('State', m['State']))
- print('%-15s: %s' % ('Folder', m['Folder']))
- print('%-15s: %s' % ('Validity', m['SMSC']['Validity']))
+ print('{0:<15}: {1}'.format('Number', m['Number']))
+ print('{0:<15}: {1}'.format('Date', str(m['DateTime'])))
+ print('{0:<15}: {1}'.format('State', m['State']))
+ print('{0:<15}: {1}'.format('Folder', m['Folder']))
+ print('{0:<15}: {1}'.format('Validity', m['SMSC']['Validity']))
loc = []
for m in x:
loc.append(str(m['Location']))
- print('%-15s: %s' % ('Location(s)', ', '.join(loc)))
+ print('{0:<15}: {1}'.format('Location(s)', ', '.join(loc)))
if v is None:
- print('\n%s' % m['Text'])
+ print('\n{0}'.format(m['Text']))
else:
for e in v['Entries']:
print()
- print('%-15s: %s' % ('Type', e['ID']))
+ print('{0:<15}: {1}'.format('Type', e['ID']))
if e['Bitmap'] is not None:
for bmp in e['Bitmap']:
print('Bitmap:')
diff --git a/examples/getalltodo.py b/examples/getalltodo.py
index dce5566..9ba7332 100755
--- a/examples/getalltodo.py
+++ b/examples/getalltodo.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -45,10 +45,10 @@ def main():
remain = remain - 1
print()
- print('%-15s: %d' % ('Location', entry['Location']))
- print('%-15s: %s' % ('Priority', entry['Priority']))
+ print('{0:<15}: {1:d}'.format('Location', entry['Location']))
+ print('{0:<15}: {1}'.format('Priority', entry['Priority']))
for v in entry['Entries']:
- print('%-15s: %s' % (v['Type'], str(v['Value'])))
+ print('{0:<15}: {1}'.format(v['Type'], str(v['Value'])))
if __name__ == '__main__':
diff --git a/examples/getdiverts.py b/examples/getdiverts.py
index db04ec4..285b592 100755
--- a/examples/getdiverts.py
+++ b/examples/getdiverts.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/examples/incoming.py b/examples/incoming.py
index c38c639..acc1314 100755
--- a/examples/incoming.py
+++ b/examples/incoming.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Michal Čihař <michal at cihar.com>
+# Copyright © 2003 - 2017 Michal Čihař <michal at cihar.com>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ def callback(state_machine, callback_type, data):
@param data: event data
@type data: hash
'''
- print('Received incoming event type %s, data:' % callback_type)
+ print('Received incoming event type {0}, data:'.format(callback_type))
print(data)
@@ -77,7 +77,7 @@ def main():
print('Press Ctrl+C to interrupt')
while 1:
signal = state_machine.GetSignalQuality()
- print('Signal is at %d%%' % signal['SignalPercent'])
+ print('Signal is at {0:d}%'.format(signal['SignalPercent']))
time.sleep(1)
if __name__ == '__main__':
diff --git a/examples/listfilesystem.py b/examples/listfilesystem.py
index 0883106..ef6f156 100755
--- a/examples/listfilesystem.py
+++ b/examples/listfilesystem.py
@@ -2,9 +2,9 @@
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
#
-# Copyright © 2003 - 2016 Matthias Blaesing <matthias.blaesing at rwth-aachen.de>
+# Copyright © 2003 - 2017 Matthias Blaesing <matthias.blaesing at rwth-aachen.de>
#
-# This file is part of python-gammu <http://wammu.eu/python-gammu/>
+# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,34 +34,34 @@ gammu --getfilesystem -flatall
from __future__ import print_function
import gammu
import locale
... 1704 lines suppressed ...
--
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