Skip to content

Commit

Permalink
setup: Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Apr 24, 2024
1 parent 1b34793 commit dfe260d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from setuptools.extension import Extension


PACKAGE_DIR = Path(__file__).resolve().parent
SOURCE_ROOT = Path(__file__).resolve().parent


def detect_version() -> str:
pkg_info = PACKAGE_DIR / "PKG-INFO"
pkg_info = SOURCE_ROOT / "PKG-INFO"
in_source_package = pkg_info.exists()
if in_source_package:
version_line = [line for line in pkg_info.read_text(encoding="utf-8").split("\n")
Expand All @@ -26,20 +26,20 @@ def detect_version() -> str:
if releng_location is not None:
sys.path.insert(0, str(releng_location.parent))
from releng.frida_version import detect
version = detect(PACKAGE_DIR).name.replace("-dev.", ".dev")
version = detect(SOURCE_ROOT).name.replace("-dev.", ".dev")
else:
version = "0.0.0"
return version


def enumerate_releng_locations() -> Iterator[Path]:
source_root = os.environ.get("MESON_SOURCE_ROOT")
if source_root is not None:
parent_releng = Path(source_root) / "releng"
val = os.environ.get("MESON_SOURCE_ROOT")
if val is not None:
parent_releng = Path(val) / "releng"
if releng_location_exists(parent_releng):
yield parent_releng

local_releng = PACKAGE_DIR / "releng"
local_releng = SOURCE_ROOT / "releng"
if releng_location_exists(local_releng):
yield local_releng

Expand All @@ -57,18 +57,18 @@ def build_extension(self, ext):

class FridaDemandBuiltExt(build_ext):
def build_extension(self, ext):
make = PACKAGE_DIR / "make.bat" if platform.system() == "Windows" else "make"
make = SOURCE_ROOT / "make.bat" if platform.system() == "Windows" else "make"
subprocess.run([make], check=True)

outputs = [entry for entry in (PACKAGE_DIR / "build" / "src").glob("_frida.*") if entry.is_file()]
outputs = [entry for entry in (SOURCE_ROOT / "build" / "src").glob("_frida.*") if entry.is_file()]
assert len(outputs) == 1
target = self.get_ext_fullpath(ext.name)
Path(target).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(outputs[0], target)


frida_version = detect_version()
long_description = (PACKAGE_DIR / "README.md").read_text(encoding="utf-8")
long_description = (SOURCE_ROOT / "README.md").read_text(encoding="utf-8")
frida_extension = os.environ.get("FRIDA_EXTENSION", None)

cmdclass = {}
Expand Down

0 comments on commit dfe260d

Please sign in to comment.