From a8eeb4968f131341c9f5279a2f2632b625b7305e Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Wed, 16 Mar 2022 17:36:57 -0700 Subject: [PATCH] Add pyproject.toml (#3193) --- pyproject.toml | 3 +++ setup.py | 68 +++++++++++++------------------------------------- 2 files changed, 21 insertions(+), 50 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..fed528d4a7a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index c89ac135489..07e898b240a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# pylint: disable=no-name-in-module,import-error,unused-variable +# pylint: disable=no-name-in-module,import-error,unused-variable,missing-class-docstring import os import sys import subprocess @@ -7,37 +7,9 @@ import platform import glob -if bytes is str: - raise Exception(""" - -=-=-=-=-=-=-=-=-=-=-=-=-= WELCOME TO THE FUTURE! =-=-=-=-=-=-=-=-=-=-=-=-=-= - -angr has transitioned to python 3. Due to the small size of the team behind it, -we can't reasonably maintain compatibility between both python 2 and python 3. -If you want to continue using the most recent version of angr (you definitely -want that, trust us) you should upgrade to python 3. It's like getting your -vaccinations. It hurts a little bit initially but in the end it's worth it. - -If you are staying on python 2 and would like to make sure you don't get -incompatible versions, make sure your pip is at least version 9.0, and it will -use our metadata to implicitly avoid them. - -For more information, see here: https://docs.angr.io/appendix/migration - -Good luck! -""") - -try: - from setuptools import setup - from setuptools import find_packages - packages = find_packages() -except ImportError: - from distutils.core import setup - packages = [x.strip('./').replace('/','.') for x in os.popen('find -name "__init__.py" | xargs -n1 dirname').read().strip().split('\n')] - -from distutils.errors import LibError -from distutils.command.build import build as _build -from distutils.command.clean import clean as _clean +from setuptools import setup, find_packages, Command +from setuptools.command.build_ext import build_ext as st_build_ext +from setuptools.errors import LibError if sys.platform == 'darwin': library_file = "angr_native.dylib" @@ -92,32 +64,28 @@ def _clean_native(): for fname in oglob: os.unlink(fname) -class build(_build): +class build_ext(st_build_ext): def run(self, *args): self.execute(_build_native, (), msg='Building angr_native') - _build.run(self, *args) + super().run(*args) + +class clean_native(Command): + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass -class clean(_clean): def run(self, *args): self.execute(_clean_native, (), msg='Cleaning angr_native') - _clean.run(self, *args) cmdclass = { - 'build': build, - 'clean': clean, + 'build_ext': build_ext, + 'clean_native': clean_native, } -try: - from setuptools.command.develop import develop as _develop - class develop(_develop): - def run(self, *args): - self.execute(_build_native, (), msg='Building angr_native') - _develop.run(self, *args) - - cmdclass['develop'] = develop -except ImportError: - pass - _UNICORN = "unicorn==1.0.2rc4" setup( @@ -126,7 +94,7 @@ def run(self, *args): python_requires='>=3.6', description='A multi-architecture binary analysis toolkit, with the ability to perform dynamic symbolic execution and various static analyses on binaries', url='https://github.com/angr/angr', - packages=packages, + packages=find_packages(), install_requires=[ 'sortedcontainers', 'cachetools',