8000 Build and publish wheels by oriori1703 · Pull Request #186 · frida/frida-tools · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build

on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
submodules: recursive
- uses: astral-sh/setup-uv@v10
- name: Build the package
run: uv build
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish to TestPyPI
if: github.event_name == 'push'
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/frida-tools
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/frida-tools
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 3 additions & 3 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- uses: psf/black@stable
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: 3.8
- uses: jamescurtin/isort-action@master
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ jobs:
pyflakes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7
- uses: lgeiger/pyflakes-action@master
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@
/frida_tools/*.zip
/frida_tools/*_agent.js
/frida_tools/bridges/
/subprojects/frida-core.wrap
/subprojects/frida-core/
/subprojects/frida-gum.wrap
/subprojects/frida-gum/
/subprojects/frida-python/
__handlers__/
2 changes: 1 addition & 1 deletion apps/tracer/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ custom_target('tracer-app',
'@PRIVATE_DIR@',
],
install: true,
install_dir: python.get_install_dir() / 'frida_tools' / 'tracer_ui',
install_dir: python.get_install_dir() / 'frida_tools',
)
16 changes: 6 additions & 10 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
project('frida-tools', 'c',
version: run_command(find_program('python3'), 8000 files('setup.py'), '-V',
version: run_command(find_program('python3'), meson.global_source_root() / 'releng' / 'frida_version.py',
capture: true,
check: true).stdout().strip(),
meson_version: '>=1.1.0',
)

meson.add_dist_script(find_program('python3'), files('set_dist_version.py'), meson.project_version())

python = import('python').find_installation()

node = find_program('node', version: '>=18.0.0', native: true, required: false)
Expand All @@ -20,19 +22,13 @@ subdir('agents')
subdir('bridges')
subdir('apps')
subdir('frida_tools')
subdir('scripts')
if get_option('scripts')
subdir('scripts')
endif
subdir('completions')

pathsep = host_machine.system() == 'windows' ? ';' : ':'

test('frida-tools', python,
args: ['-m', 'unittest', 'discover'],
workdir: meson.current_source_dir(),
env: {
'PYTHONPATH': pathsep.join([
meson.current_source_dir() / 'subprojects' / 'frida-python',
meson.current_build_dir() / 'subprojects' / 'frida-python' / 'src',
]),
},
timeout: 30,
)
1 change: 1 addition & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('scripts', type: 'boolean', value: true, description: 'Install wrapper scripts for the CLI tools')
83 changes: 83 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
[project]
name = "frida-tools"
dynamic = ["version"]
description = "Frida CLI tools"
readme = { text = "CLI tools for [Frida](https://frida.re).", content-type = "text/markdown" }
authors = [{ name = "Frida Developers", email = "oleavr@frida.re" }]
license = "LGPL-2.0-or-later WITH WxWindows-exception-3.1"
license-files = ["COPYING"]
keywords = [
"frida",
"debugger",
"dynamic",
"instrumentation",
"inject",
"javascript",
"windows",
"macos",
"linux",
"ios",
"iphone",
"ipad",
"android",
"qnx",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: JavaScript",
"Topic :: Software Development :: Debuggers",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.7"
dependencies = [
"colorama >= 0.2.7, < 1.0.0",
"frida >= 17.10.0, < 18.0.0",
"prompt-toolkit >= 2.0.0, < 4.0.0",
"pygments >= 2.0.2, < 3.0.0",
"websockets >= 13.0.0, < 14.0.0",
]

[project.urls]
Homepage = "https://frida.re"
Repository = "https://github.com/frida/frida-tools"

[project.scripts]
frida = "frida_tools.repl:main"
frida-ls-devices = "frida_tools.lsd:main"
frida-ps = "frida_tools.ps:main"
frida-kill = "frida_tools.kill:main"
frida-ls = "frida_tools.ls:main"
frida-rm = "frida_tools.rm:main"
frida-pull = "frida_tools.pull:main"
frida-push = "frida_tools.push:main"
frida-discover = "frida_tools.discoverer:main"
frida-trace = "frida_tools.tracer:main"
frida-strace = "frida_tools.stracer:main"
frida-itrace = "frida_tools.itracer:main"
frida-join = "frida_tools.join:main"
frida-create = "frida_tools.creator:main"
frida-compile = "frida_tools.compiler:main"
frida-pm = "frida_tools.pm:main"
frida-apk = "frida_tools.apk:main"

[build-system]
build-backend = "mesonpy"
requires = ["meson-python >= 0.18.0"]

[tool.meson-python.args]
setup = ["-Dscripts=false"]

[tool.black]
line-length = 120

Expand Down
34 changes: 34 additions & 0 deletions set_dist_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

import argparse
import os
import shlex
import subprocess


def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("version", type=str)
args = parser.parse_args()
set_dist_version(args.version)


def set_dist_version(version: str) -> None:
subprocess.run(
[
*shlex.split(os.environ["MESONREWRITE"]),
"--sourcedir",
os.environ["MESON_PROJECT_DIST_ROOT"],
"kwargs",
"set",
"project",
"/",
"version",
version,
],
check=True,
)


if __name__ == "__main__":
main()
Loading
Loading
0