Skip to content

Commit

Permalink
Add pyproject.toml (angr#3193)
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin authored Mar 17, 2022
1 parent 3b62865 commit a8eeb49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 50 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
68 changes: 18 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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(
Expand All @@ -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',
Expand Down

0 comments on commit a8eeb49

Please sign in to comment.