Merge pull request #353 from carver/release-tools

Pre-release testing tools, plus setup.py updates
This commit is contained in:
Jason Carver 2019-11-15 12:05:35 -08:00 committed by GitHub
commit 32aa20ec39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 9 deletions

View File

@ -27,7 +27,15 @@ protobufs: $(PY)
%_pb2.py: %.proto %_pb2.py: %.proto
protoc --python_out=. --mypy_out=. $< protoc --python_out=. --mypy_out=. $<
.PHONY: clean clean-proto:
rm -f $(PY) $(PYI)
clean: clean:
rm -f $(PY) $(PYI) find . -name '__pycache__' -exec rm -rf {} +
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
package: clean
python setup.py sdist bdist_wheel
python scripts/release/test_package.py

View File

@ -24,8 +24,7 @@ class RSAPublicKey(PublicKey):
def verify(self, data: bytes, signature: bytes) -> bool: def verify(self, data: bytes, signature: bytes) -> bool:
h = SHA256.new(data) h = SHA256.new(data)
try: try:
# NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``verify``. pkcs1_15.new(self.impl).verify(h, signature)
pkcs1_15.new(self.impl).verify(h, signature) # type: ignore
except (ValueError, TypeError): except (ValueError, TypeError):
return False return False
return True return True
@ -48,8 +47,7 @@ class RSAPrivateKey(PrivateKey):
def sign(self, data: bytes) -> bytes: def sign(self, data: bytes) -> bytes:
h = SHA256.new(data) h = SHA256.new(data)
# NOTE: the typing in ``pycryptodome`` is wrong on the arguments to ``sign``. return pkcs1_15.new(self.impl).sign(h)
return pkcs1_15.new(self.impl).sign(h) # type: ignore
def get_public_key(self) -> PublicKey: def get_public_key(self) -> PublicKey:
return RSAPublicKey(self.impl.publickey()) return RSAPublicKey(self.impl.publickey())

View File

@ -1,6 +1,6 @@
import setuptools import setuptools
classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]] py_classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]]
extras_require = { extras_require = {
@ -18,7 +18,14 @@ extras_require = {
"flake8>=3.7.7,<4.0.0", "flake8>=3.7.7,<4.0.0",
"flake8-bugbear", "flake8-bugbear",
], ],
"dev": ["tox>=3.13.2,<4.0.0", "docformatter"], "dev": [
"bumpversion>=0.5.3,<1",
"docformatter",
"setuptools>=36.2.0",
"tox>=3.13.2,<4.0.0",
"twine",
"wheel",
],
} }
extras_require["dev"] = ( extras_require["dev"] = (
@ -26,13 +33,30 @@ extras_require["dev"] = (
) )
with open("./README.md") as readme:
long_description = readme.read()
setuptools.setup( setuptools.setup(
name="libp2p", name="libp2p",
description="libp2p implementation written in python", description="libp2p implementation written in python",
version="0.1.2", version="0.1.2",
long_description=long_description,
long_description_content_type="text/markdown",
maintainer="The Ethereum Foundation",
maintainer_email="snakecharmers@ethereum.org",
url="https://github.com/ethereum/py-libp2p",
license="MIT/APACHE2.0", license="MIT/APACHE2.0",
platforms=["unix", "linux", "osx"], platforms=["unix", "linux", "osx"],
classifiers=classifiers, classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
]
+ py_classifiers,
python_requires=">=3.7,<4",
install_requires=[ install_requires=[
"pycryptodome>=3.8.2,<4.0.0", "pycryptodome>=3.8.2,<4.0.0",
"base58>=1.0.3,<2.0.0", "base58>=1.0.3,<2.0.0",
@ -48,4 +72,5 @@ setuptools.setup(
extras_require=extras_require, extras_require=extras_require,
packages=setuptools.find_packages(exclude=["tests", "tests.*"]), packages=setuptools.find_packages(exclude=["tests", "tests.*"]),
zip_safe=False, zip_safe=False,
keywords="libp2p p2p",
) )