diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..aa7c64f --- /dev/null +++ b/poetry.lock @@ -0,0 +1,112 @@ +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "packaging" +version = "24.0" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, + {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, +] + +[[package]] +name = "pathlib" +version = "1.0.1" +description = "Object-oriented filesystem paths" +optional = false +python-versions = "*" +files = [ + {file = "pathlib-1.0.1-py3-none-any.whl", hash = "sha256:f35f95ab8b0f59e6d354090350b44a80a80635d22efdedfa84c7ad1cf0a74147"}, + {file = "pathlib-1.0.1.tar.gz", hash = "sha256:6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f"}, +] + +[[package]] +name = "pluggy" +version = "1.4.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "8.1.1" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.1.1-py3-none-any.whl", hash = "sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7"}, + {file = "pytest-8.1.1.tar.gz", hash = "sha256:ac978141a75948948817d360297b7aae0fcb9d6ff6bc9ec6d514b85d5a65c044"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.4,<2.0" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.8" +content-hash = "94eb910b7281f9fabe2959c9ea9653f057ac1f0609f2e920e5af8ac3d33ee9fc" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b756d94 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "debugger" +version = "1.0.0" +description = "The official Binary Ninja debugger plugin." +authors = ["Xusheng "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.8" +pathlib = "^1.0.1" +pytest = "^8.1.1" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/scripts/build.py b/scripts/build.py index eb652b5..53b2c74 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -198,7 +198,6 @@ def extract_zip(bundle, target): with open(license_path, 'r') as f: env["BN_LICENSE"] = f.read() -winpath = '' if platform.system() == "Linux": bn_python_path = bn_core_path / 'python' elif platform.system() == "Darwin": @@ -206,7 +205,6 @@ def extract_zip(bundle, target): bn_python_path = bn_python_path.resolve() elif platform.system() == "Windows": bn_python_path = bn_core_path / 'python' - winpath = os.environ["LOCALAPPDATA"] + "\\Programs\\Python\\Python38\\Scripts\\" pythonpath = f'{bn_python_path}{os.pathsep}{build_output_path / "plugins"}' env["PYTHONPATH"] = str(pythonpath) @@ -220,15 +218,10 @@ def extract_zip(bundle, target): str(base_dir / "test" / "debugger_test.py") ] -# Prevents https://github.com/pypa/pipenv/issues/5052 -subprocess.run(["pipenv", "--rm"], env=env) -p = subprocess.Popen(["pipenv", "run", winpath + "py.test", "-x", "--junitxml", str(results)] + pytest_sources, env=env) +p = subprocess.Popen(["pytest", "-s", "--junitxml", str(results)] + pytest_sources, env=env) # wait for process to complete p_stdout, p_stderr = p.communicate() -assert 0 <= p.returncode < 128, f"pipenv run failed: {p_stdout} {p_stderr}" -p = subprocess.Popen(["pipenv", "--rm"], env=env) -p_stdout, p_stderr = p.communicate() -assert p.returncode == 0, f"pipenv --rm failed: {p_stdout} {p_stderr}" +assert 0 <= p.returncode < 128, f"test run failed: {p_stdout} {p_stderr}" sys.exit(0) diff --git a/scripts/build_linux b/scripts/build_linux index d78f6f1..745324f 100755 --- a/scripts/build_linux +++ b/scripts/build_linux @@ -1,4 +1,5 @@ #!/bin/bash export PATH=~/.local/bin:$PATH export PYTHONUNBUFFERED=1 -python3 scripts/build.py "$@" +poetry install --sync --no-root +poetry run python3 scripts/build.py "$@" diff --git a/scripts/build_macosx b/scripts/build_macosx index 3d32c93..bf15e56 100755 --- a/scripts/build_macosx +++ b/scripts/build_macosx @@ -1,4 +1,5 @@ #!/bin/bash export PATH=/usr/local/bin:~/Library/Python/3.9/bin:$PATH export PYTHONUNBUFFERED=1 -python3 scripts/build.py "$@" +poetry install --sync --no-root +poetry run python3 scripts/build.py "$@" diff --git a/scripts/build_win64.bat b/scripts/build_win64.bat index 3e24b36..a73d2d1 100644 --- a/scripts/build_win64.bat +++ b/scripts/build_win64.bat @@ -1,4 +1,4 @@ @echo off set PYTHONUNBUFFERED=1 - -py -3 scripts\build.py %* +poetry install --sync --no-root +poetry run py -3 scripts\build.py %*