From f773ad392da57e6be4ade93c44baa5d2057c40b6 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Mon, 19 Nov 2018 21:19:42 +1100 Subject: python: import constant * lang/python/src/constants/__init__.py: dropped use of Import capitalisation and renamed lang/python/src/constants/import.py to lang/python/src/constants/import_type.py to address bug T4242. * lang/python/doc/src/gpgme-python-howto: minor docs updates. --- lang/python/src/constants/__init__.py | 18 ++++++++++-------- lang/python/src/constants/import.py | 22 ---------------------- lang/python/src/constants/import_type.py | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 30 deletions(-) delete mode 100644 lang/python/src/constants/import.py create mode 100644 lang/python/src/constants/import_type.py (limited to 'lang/python/src') diff --git a/lang/python/src/constants/__init__.py b/lang/python/src/constants/__init__.py index 1f79f84a..4e5ced24 100644 --- a/lang/python/src/constants/__init__.py +++ b/lang/python/src/constants/__init__.py @@ -27,19 +27,21 @@ util.process_constants('GPGME_', globals()) # For convenience, we import the modules here. from . import data, keylist, sig, tofu # The subdirs. # The remaining modules can no longer fit on one line. -from . import create, event, keysign, md, pk, protocol, sigsum, status -from . import validity +from . import create, event, import_type, keysign, md, pk, protocol, sigsum +from . import status, validity del absolute_import, print_function, unicode_literals, util -# A complication arises because 'import' is a reserved keyword. -# Import it as 'Import' instead. -globals()['Import'] = getattr( - __import__('', globals(), locals(), [str('import')], 1), "import") +# This was a bad idea (though I get why it was done): +# +# # A complication arises because 'import' is a reserved keyword. +# # Import it as 'Import' instead. +# globals()['Import'] = getattr( +# __import__('', globals(), locals(), [str('import')], 1), "import") __all__ = [ - 'data', 'event', 'import', 'keysign', 'keylist', 'md', 'pk', 'protocol', - 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' + 'data', 'event', 'import_type', 'keysign', 'keylist', 'md', 'pk', + 'protocol', 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' ] # GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We diff --git a/lang/python/src/constants/import.py b/lang/python/src/constants/import.py deleted file mode 100644 index e477eb25..00000000 --- a/lang/python/src/constants/import.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals - -from gpg import util -util.process_constants('GPGME_IMPORT_', globals()) -del absolute_import, print_function, unicode_literals, util diff --git a/lang/python/src/constants/import_type.py b/lang/python/src/constants/import_type.py new file mode 100644 index 00000000..e477eb25 --- /dev/null +++ b/lang/python/src/constants/import_type.py @@ -0,0 +1,22 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_IMPORT_', globals()) +del absolute_import, print_function, unicode_literals, util -- cgit v1.2.3