From 3b9cf2882511b5da9bbf53c6ccfdc2f4cbde691c Mon Sep 17 00:00:00 2001 From: Juan Altmayer Pizzorno Date: Thu, 8 Dec 2022 13:12:40 -0500 Subject: [PATCH] - "vendored" crdp to reduce dependencies; --- GNUmakefile | 5 ++++- scalene/scalene_json.py | 2 +- setup.py | 30 ++++++++++++++---------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index e7ff02a4b..86992508f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -61,7 +61,10 @@ vendor/printf/printf.cpp: cd vendor/printf && ln -s printf.c printf.cpp sed $(SED_INPLACE) -e 's/^#define printf printf_/\/\/&/' vendor/printf/printf.h -vendor-deps: vendor/Heap-Layers vendor/printf/printf.cpp +vendor/crdp: + mkdir -p vendor && cd vendor && git clone https://github.com/plasma-umass/crdp + +vendor-deps: vendor/Heap-Layers vendor/printf/printf.cpp vendor/crdp mypy: -mypy $(PYTHON_SOURCES) diff --git a/scalene/scalene_json.py b/scalene/scalene_json.py index 2e5539fb8..73ae5a490 100644 --- a/scalene/scalene_json.py +++ b/scalene/scalene_json.py @@ -15,7 +15,7 @@ from scalene.scalene_statistics import Filename, LineNumber, ScaleneStatistics if sys.platform != "win32": - from crdp import rdp + from scalene.crdp import rdp class ScaleneJSON: diff --git a/setup.py b/setup.py index 6b534965d..db72e5c9a 100755 --- a/setup.py +++ b/setup.py @@ -147,26 +147,18 @@ def copy_extensions_to_source(self): py_limited_api=False, language="c++") +crdp = Extension('scalene.crdp', + include_dirs=[], + sources = ['vendor/crdp/crdp.c'], + py_limited_api=True, + language="c") + # If we're testing packaging, build using a ".devN" suffix in the version number, # so that we can upload new files (as testpypi/pypi don't allow re-uploading files with # the same name as previously uploaded). # Numbering scheme: https://www.python.org/dev/peps/pep-0440 dev_build = ('.dev' + environ['DEV_BUILD']) if 'DEV_BUILD' in environ else '' -install_requires = [ - "wheel>=0.36.1", - "rich>=10.7.0", - "cloudpickle>=1.5.0", - "pynvml>=11.0.0", - "Jinja2>=3.0.3", - ] - -non_win_requires = [ "Cython==0.29.32", - "crdp @ git+https://github.com/plasma-umass/crdp.git#egg=crdp" ] - -if sys.platform != 'win32': - install_requires += non_win_requires - setup( name="scalene", version=scalene_version + dev_build, @@ -204,8 +196,14 @@ def copy_extensions_to_source(self): 'egg_info': EggInfoCommand, 'build_ext': BuildExtCommand, }, - install_requires=install_requires, - ext_modules=([get_line_atomic, pywhere] if sys.platform != 'win32' else []), + install_requires=[ + "wheel>=0.36.1", + "rich>=10.7.0", + "cloudpickle>=1.5.0", + "pynvml>=11.0.0", + "Jinja2>=3.0.3", + ], + ext_modules=([get_line_atomic, pywhere, crdp] if sys.platform != 'win32' else []), setup_requires=['wheel', 'Cython', 'setuptools_scm'], include_package_data=True, entry_points={"console_scripts": ["scalene = scalene.__main__:main"]},