Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Jul 6, 2018
2 parents 705d7f4 + 26c4caf commit 769c74d
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 36 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ nosetests.xml
*~
*.swp
*.swo
*.orig

# tags
TAGS
Expand All @@ -56,10 +57,10 @@ tags
*random_seed*
*.log
tests/doctests/*
gnupg/test/doctests/*
gnupg/test/logs/*
gnupg/test/tmp/*
gnupg/test/files/*
pretty_bad_protocol/test/doctests/*
pretty_bad_protocol/test/logs/*
pretty_bad_protocol/test/tmp/*
pretty_bad_protocol/test/files/*

# Ignore distutils record of installed files:
installed-files.txt
Expand Down
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SHELL=/bin/sh
TESTDIR=./gnupg/test
TESTDIR=./pretty_bad_protocol/test
TESTHANDLE=$(TESTDIR)/test_gnupg.py
FILES=$(SHELL find ./gnupg/ -name "*.py" -printf "%p,")
FILES=$(SHELL find ./pretty_bad_protocol/ -name "*.py" -printf "%p,")
PYTHON=$(SHELL which python)
PYTHON3=$(SHELL which python3)
PKG_NAME=python-gnupg
PKG_NAME=pretty_bad_protocol
DOC_DIR=docs
DOC_BUILD_DIR:=$(DOC_DIR)/_build
DOC_HTML_DIR:=$(DOC_BUILD_DIR)/html
Expand All @@ -29,8 +29,8 @@ cleanup-src: pycremoval

cleanup-tests: cleanup-src
cd $(TESTDIR) && rm -f \#*\#
mkdir -p gnupg/test/tmp
mkdir -p gnupg/test/logs
mkdir -p $(TESTDIR)/tmp
mkdir -p $(TESTDIR)/logs

cleanup-tests-all: cleanup-tests
rm -rf tests/tmp
Expand All @@ -42,6 +42,10 @@ cleanup-build:
cleanup-dist:
-rm -rf dist

clean: cleanup-build cleanup-tests-all cleanup-src

dist-clean: clean cleanup-dist

# it's not strictly necessary that gnupg2, gpg-agent, pinentry, or pip be
# installed, so ignore error exit statuses for those commands
test-before: cleanup-src cleanup-tests
Expand Down Expand Up @@ -111,11 +115,9 @@ coverage-html:
coverage html --rcfile=".coveragerc"

clean-test:
touch gnupg/test/placeholder.log
mv gnupg/test/*.log gnupg/test/logs/
rm gnupg/test/logs/placeholder.log
touch gnupg/test/random_seed_is_sekritly_pi
rm gnupg/test/random_seed*
-mv $(TESTDIR)/*.log $(TESTDIR)/logs/
-rm $(TESTDIR)/logs/placeholder.log
-rm $(TESTDIR)/random_seed*

test: test-run clean-test

Expand Down
28 changes: 18 additions & 10 deletions README
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.. -*- coding: utf-8; mode: rst; -*-
**************************************
python-gnupg |On PyPI|
**************************************
*******************************************************
pretty-bad-protocol (a.k.a. python-gnupg) |On PyPI|
*******************************************************

Rewrite of `Vinay Sajip's python-gnupg <https://code.google.com/p/python-gnupg/>`__,
Complete rewrite of `Vinay Sajip's python-gnupg <https://code.google.com/p/python-gnupg/>`__,
including patches to fix a shell injection vulnerability due to unsanitised
inputs being passed to ``subprocess.Popen([...], shell=True)``.

Expand All @@ -21,6 +21,11 @@ From `PyPI <https://pypi.python.org>`__

It's simple. Just do::

[sudo] pip install pretty-bad-security

Additionally, the legacy way to install versions of this library <
3.0.0 is::

[sudo] pip install gnupg

--------
Expand All @@ -42,8 +47,7 @@ Optionally, to build the Sphinx documentation_, do::
To get started using python-gnupg's API, see the documentation_,
and import the module like so::

>>> import gnupg

>>> from pretty_bad_protocol import gnupg

The primary interface class you'll likely want to interact with is ``gnupg.GPG``::

Expand Down Expand Up @@ -76,7 +80,11 @@ The primary interface class you'll likely want to interact with is ``gnupg.GPG``
Bug Reports & Feature Requests
==============================

Our bugtracker can be found
`on Github <https://github.com/isislovecruft/python-gnupg/issues>`__. Public
comments and discussions are also welcome on the bugtracker, or as
`tweets <https://twitter.com/isislovecruft>`__. Patches are always welcome.
Our bugtracker can be found `on Github
<https://github.com/isislovecruft/python-gnupg/issues>`__. Public comments and
discussions are also welcome on the bugtracker. Patches are always welcome.

I increasingly have less and less time to deal with maintaining this
module. Please be patient, and if there is a patch your project
urgently needs, please consider temporarily forking until I or one of
the other maintainers can get to your issue.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# built documents.
#
# The short X.Y version.
import gnupg
from pretty_bad_protocol import gnupg
version = gnupg.__version__
# The full version, including alpha/beta/rc tags.
release = gnupg.__version__
Expand Down
8 changes: 5 additions & 3 deletions gnupg/__init__.py → pretty_bad_protocol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of python-gnupg, a Python interface to GnuPG.
Expand Down Expand Up @@ -35,12 +34,15 @@
__license__ = copyleft.full_text
__copyleft__ = copyleft.copyright

gnupg.__version__ = __version__
gnupg.__authors__ = __authors__
gnupg.__licence__ = __license__
gnupg.__copyleft__ = __copyleft__

## do not set __package__ = "gnupg", else we will end up with
## gnupg.<*allofthethings*>
__all__ = ["GPG", "_util", "_parsers", "_meta", "_logger"]

## avoid the "from gnupg import gnupg" idiom
del gnupg
del absolute_import
del copyleft
del get_versions
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion gnupg/_parsers.py → pretty_bad_protocol/_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,8 @@ def _handle_status(self, key, value):
self.status += " on {}".format(str(value))
elif key == "NODATA":
self.status = nodata(value)
elif key == "PROGRESS":
self.status = progress(value.split(" ", 1)[0])
else:
raise ValueError("Unknown status message: %r" % key)

Expand Down Expand Up @@ -1498,6 +1500,7 @@ def _handle_status(self, key, value):
"PROGRESS",
"PINENTRY_LAUNCHED",
"SUCCESS",
"UNEXPECTED",
):
pass
elif key == "KEY_CONSIDERED":
Expand Down Expand Up @@ -1653,7 +1656,7 @@ def _handle_status(self, key, value):
else:
pass
else:
raise ValueError("Unknown status message: %r" % key)
raise ValueError("Unknown status message: %r %r" % (key, value))


class Crypt(Verify):
Expand Down
4 changes: 4 additions & 0 deletions gnupg/_trust.py → pretty_bad_protocol/_trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def export_ownertrust(cls, trustdb=None):
export_proc = cls._open_subprocess(['--export-ownertrust'])
tdb = open(trustdb, 'wb')
_util._threaded_copy_data(export_proc.stdout, tdb)
export_proc.wait()

def import_ownertrust(cls, trustdb=None):
"""Import ownertrust from a trustdb file.
Expand All @@ -79,6 +80,7 @@ def import_ownertrust(cls, trustdb=None):
log.error("trustdb file %s does not exist!" % trustdb)

_util._threaded_copy_data(tdb, import_proc.stdin)
import_proc.wait()

def fix_trustdb(cls, trustdb=None):
"""Attempt to repair a broken trustdb.gpg file.
Expand Down Expand Up @@ -106,3 +108,5 @@ def fix_trustdb(cls, trustdb=None):
export_proc = cls._open_subprocess(['--export-ownertrust'])
import_proc = cls._open_subprocess(['--import-ownertrust'])
_util._threaded_copy_data(export_proc.stdout, import_proc.stdin)
export_proc.wait()
import_proc.wait()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
_isPyPy = True


versioneer.versionfile_source = 'gnupg/_version.py'
versioneer.versionfile_build = 'gnupg/_version.py'
versioneer.versionfile_source = 'pretty_bad_protocol/_version.py'
versioneer.versionfile_build = 'pretty_bad_protocol/_version.py'
versioneer.tag_prefix = ''
versioneer.parentdir_prefix = 'gnupg-'
versioneer.parentdir_prefix = 'pretty-bad-protocol-'

__author__ = "Isis Agora Lovecruft"
__contact__ = '[email protected]'
Expand Down Expand Up @@ -97,7 +97,7 @@ def get_requirements():


setuptools.setup(
name = "gnupg",
name = "pretty-bad-protocol",
description="A Python wrapper for GnuPG",
long_description = """\
This module allows easy access to GnuPG's key management, encryption and \
Expand All @@ -118,11 +118,13 @@ def get_requirements():
maintainer_email=__contact__,
url=__url__,

package_dir={'gnupg': 'gnupg'},
packages=['gnupg'],
package_dir={
'pretty_bad_protocol': 'pretty_bad_protocol',
},
packages=['pretty_bad_protocol'],
package_data={'': ['README', 'LICENSE', 'TODO', 'requirements.txt']},
scripts=['versioneer.py'],
test_suite='gnupg.test.test_gnupg',
test_suite='pretty_bad_protocol.test.test_gnupg',

install_requires=requires,
dependency_links=deplinks,
Expand Down

0 comments on commit 769c74d

Please sign in to comment.