diff --git a/docs/source/conf.py b/docs/source/conf.py index 36f41a8c..7169c4fa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,14 +20,14 @@ sys.path.insert(0, os.path.abspath("../../")) # -- Project information ----------------------------------------------------- -project = "Mythril Classic" -copyright = "2018, Bernhard Mueller" -author = "Bernhard Mueller" +project = "Mythril" +copyright = "2019, ConsenSys Diligence" +author = "ConsenSys Dilligence" # The short X.Y version version = "" # The full version, including alpha/beta/rc tags -from mythril.version import VERSION +from mythril.__version__ import __version__ as VERSION release = VERSION diff --git a/mythril/__init__.py b/mythril/__init__.py index bfd74099..5f8e6963 100644 --- a/mythril/__init__.py +++ b/mythril/__init__.py @@ -3,4 +3,4 @@ __docformat__ = "restructuredtext" # Accept mythril.VERSION to get mythril's current version number -from .version import VERSION # NOQA +from .__version__ import __version__ as VERSION # NOQA diff --git a/mythril/version.py b/mythril/__version__.py similarity index 100% rename from mythril/version.py rename to mythril/__version__.py diff --git a/mythril/interfaces/cli.py b/mythril/interfaces/cli.py index ad2d79c7..e3725d38 100644 --- a/mythril/interfaces/cli.py +++ b/mythril/interfaces/cli.py @@ -22,7 +22,7 @@ from mythril.mythril import ( MythrilConfig, MythrilLevelDB, ) -from mythril.version import VERSION +from mythril.__version__ import __version__ as VERSION log = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index 21474308..b46a378f 100755 --- a/setup.py +++ b/setup.py @@ -9,21 +9,82 @@ publish to pypi w/o having to convert Readme.md to RST: """ from setuptools import setup, find_packages from setuptools.command.install import install -from pathlib import Path import sys import os +import io -# To make lint checkers happy we set VERSION here, but -# it is redefined by the exec below +# Package meta-data. +NAME = "mythril" +DESCRIPTION = "Security analysis tool for Ethereum smart contracts" +URL = "https://github.com/ConsenSys/mythril" +AUTHOR = "ConsenSys Dilligence" +AUTHOR_MAIL = None +REQUIRES_PYTHON = ">=3.5.0" + + +# What packages are required for this module to be executed? +REQUIRED = [ + "coloredlogs>=10.0", + "py_ecc==1.4.2", + "ethereum>=2.3.2", + "z3-solver>=4.8.5.0", + "requests", + "py-solc", + "plyvel", + "eth_abi==1.3.0", + "eth-utils>=1.0.1", + "eth-account>=0.1.0a2,<=0.3.0", + "eth-hash>=0.1.0", + "eth-keyfile>=0.5.1", + "eth-keys>=0.2.0b3", + "eth-rlp>=0.1.0", + "eth-tester==0.1.0b32", + "eth-typing>=2.0.0", + "coverage", + "jinja2>=2.9", + "rlp>=1.0.1", + "transaction>=2.2.1", + "py-flags", + "mock", + "configparser>=3.5.0", + "persistent>=4.2.0", + "ethereum-input-decoder>=0.2.2", + "matplotlib", +] + +TESTS_REQUIRE = ["mypy", "pytest>=3.6.0", "pytest_mock", "pytest-cov"] + +# What packages are optional? +EXTRAS = { + # 'fancy feature': ['django'], +} + +# If version is set to None then it will be fetched from __version__.py VERSION = None -# Package version (vX.Y.Z). It must match git tag being used for CircleCI -# deployment; otherwise the build will failed. +here = os.path.abspath(os.path.dirname(__file__)) + +# Import the README and use it as the long-description. +# Note: this will only work if 'README.md' is present in your MANIFEST.in file! +try: + with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f: + long_description = "\n" + f.read() +except FileNotFoundError: + long_description = DESCRIPTION -version_path = (Path(__file__).parent / "mythril" / "version.py").absolute() -exec(open(str(version_path), "r").read()) +# Load the package's __version__.py module as a dictionary. +about = {} +if not VERSION: + project_slug = NAME.lower().replace("-", "_").replace(" ", "_") + with open(os.path.join(here, project_slug, "__version__.py")) as f: + exec(f.read(), about) +else: + about["__version__"] = VERSION + +# Package version (vX.Y.Z). It must match git tag being used for CircleCI +# deployment; otherwise the build will failed. class VerifyVersionCommand(install): """Custom command to verify that the git tag matches our version.""" @@ -40,25 +101,15 @@ class VerifyVersionCommand(install): sys.exit(info) -def read_file(fname): - """return file contents. - - :param fname: path relative to setup.py - :return: file contents - """ - with open(os.path.join(os.path.dirname(__file__), fname), "r") as fd: - return fd.read() - - setup( - name="mythril", - version=VERSION[1:], - description="Security analysis tool for Ethereum smart contracts", - long_description=read_file("README.md") if os.path.isfile("README.md") else "", + name=NAME, + version=about["__version__"][1:], + description=DESCRIPTION, + long_description=long_description, long_description_content_type="text/markdown", # requires twine and recent setuptools - url="https://github.com/b-mueller/mythril", - author="Bernhard Mueller", - author_email="bernhard.mueller11@gmail.com", + url=URL, + author=AUTHOR, + author_mail=AUTHOR_MAIL, license="MIT", classifiers=[ "Development Status :: 3 - Alpha", @@ -71,37 +122,10 @@ setup( ], keywords="hacking disassembler security ethereum", packages=find_packages(exclude=["contrib", "docs", "tests"]), - install_requires=[ - "coloredlogs>=10.0", - "py_ecc==1.4.2", - "ethereum>=2.3.2", - "z3-solver>=4.8.5.0", - "requests", - "py-solc", - "plyvel", - "eth_abi==1.3.0", - "eth-utils>=1.0.1", - "eth-account>=0.1.0a2,<=0.3.0", - "eth-hash>=0.1.0", - "eth-keyfile>=0.5.1", - "eth-keys>=0.2.0b3", - "eth-rlp>=0.1.0", - "eth-tester==0.1.0b32", - "eth-typing>=2.0.0", - "coverage", - "jinja2>=2.9", - "rlp>=1.0.1", - "transaction>=2.2.1", - "py-flags", - "mock", - "configparser>=3.5.0", - "persistent>=4.2.0", - "ethereum-input-decoder>=0.2.2", - "matplotlib", - ], - tests_require=["mypy", "pytest>=3.6.0", "pytest_mock", "pytest-cov"], - python_requires=">=3.5", - extras_require={}, + install_requires=REQUIRED, + tests_require=TESTS_REQUIRE, + python_requires=REQUIRES_PYTHON, + extras_require=EXTRAS, package_data={"mythril.analysis.templates": ["*"], "mythril.support.assets": ["*"]}, include_package_data=True, entry_points={"console_scripts": ["myth=mythril.interfaces.cli:main"]},