Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc909ceda6 | ||
|
|
cbba912483 |
18
.github/workflows/python-build.yml
vendored
18
.github/workflows/python-build.yml
vendored
@@ -9,35 +9,29 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-python-packages:
|
build-python-packages:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: pyadb_client
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python build dependencies
|
||||||
run: pip install .
|
run: pip install ".[build]"
|
||||||
|
|
||||||
- name: Build Python packages
|
- name: Build Python packages
|
||||||
run: maturin build --release --interpreter "3.8" --interpreter "3.9" --interpreter "3.10" --interpreter "3.11" --interpreter "3.12" --interpreter "3.13"
|
run: maturin build --release --compatibility manylinux_2_25 --auditwheel=skip
|
||||||
|
|
||||||
publish-python-packages:
|
publish-python-packages:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: pyadb_client
|
|
||||||
needs: [build-python-packages]
|
needs: [build-python-packages]
|
||||||
if: github.event_name == 'release' && github.event.action == 'created'
|
if: github.event_name == 'release' && github.event.action == 'created'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python build dependencies
|
||||||
run: pip install .
|
run: pip install ".[build]"
|
||||||
|
|
||||||
- name: Publish Python packages
|
- name: Publish Python packages
|
||||||
run: maturin publish --non-interactive
|
run: maturin publish --non-interactive --compatibility manylinux_2_25 --auditwheel=skip
|
||||||
env:
|
env:
|
||||||
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
|
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ homepage = "https://github.com/cocool97/adb_client"
|
|||||||
keywords = ["adb", "android", "tcp", "usb"]
|
keywords = ["adb", "android", "tcp", "usb"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/cocool97/adb_client"
|
repository = "https://github.com/cocool97/adb_client"
|
||||||
version = "2.1.4"
|
version = "2.1.5"
|
||||||
|
|
||||||
# To build locally when working on a new release
|
# To build locally when working on a new release
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ crate-type = ["cdylib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { version = "1.0.94" }
|
anyhow = { version = "1.0.94" }
|
||||||
adb_client = { version = "2.0.6" }
|
adb_client = { version = "2.0.6" }
|
||||||
pyo3 = { version = "0.23.3", features = ["extension-module", "anyhow"] }
|
pyo3 = { version = "0.23.4", features = ["extension-module", "anyhow", "abi3-py37"] }
|
||||||
|
|||||||
@@ -2,11 +2,19 @@
|
|||||||
|
|
||||||
Python library to communicate with ADB devices. Built on top of Rust `adb_client` library.
|
Python library to communicate with ADB devices. Built on top of Rust `adb_client` library.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install pyadb_client
|
||||||
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Use ADB server
|
### Use ADB server
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
from pyadb_client import pyadb_client
|
||||||
|
|
||||||
server = pyadb_client.PyADBServer("127.0.0.1:5037")
|
server = pyadb_client.PyADBServer("127.0.0.1:5037")
|
||||||
for i, device in enumerate(server.devices()):
|
for i, device in enumerate(server.devices()):
|
||||||
print(i, device.identifier, device.state)
|
print(i, device.identifier, device.state)
|
||||||
@@ -19,6 +27,8 @@ print(device, device.identifier)
|
|||||||
### Push a file on device
|
### Push a file on device
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
from pyadb_client import pyadb_client
|
||||||
|
|
||||||
usb_device = PyADBUSBDevice.autodetect()
|
usb_device = PyADBUSBDevice.autodetect()
|
||||||
usb_device.push("file.txt", "/data/local/tmp/file.txt")
|
usb_device.push("file.txt", "/data/local/tmp/file.txt")
|
||||||
```
|
```
|
||||||
@@ -31,14 +41,12 @@ cd pyadb_client
|
|||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
|
|
||||||
# Install needed dependencies
|
# Install needed build dependencies
|
||||||
pip install -e .
|
pip install ".[build]"
|
||||||
|
|
||||||
# Build development package
|
# Build development package
|
||||||
maturin develop
|
maturin develop
|
||||||
|
|
||||||
# Build release Python package
|
# Build release Python package
|
||||||
maturin build --release
|
maturin build --release
|
||||||
|
```
|
||||||
# Publish Python package
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
[build-system]
|
|
||||||
requires = ["maturin>=1,<2"]
|
|
||||||
build-backend = "maturin"
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "pyadb_client"
|
|
||||||
dependencies = ["maturin", "patchelf"]
|
|
||||||
dynamic = ["version"] # Let the build system automatically set package version
|
|
||||||
classifiers = [
|
|
||||||
"Programming Language :: Rust",
|
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
|
||||||
]
|
|
||||||
16
pyproject.toml
Normal file
16
pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[build-system]
|
||||||
|
build-backend = "maturin"
|
||||||
|
requires = ["maturin>=1,<2"]
|
||||||
|
|
||||||
|
[project]
|
||||||
|
classifiers = ["Programming Language :: Python", "Programming Language :: Rust"]
|
||||||
|
dynamic = ["authors", "keywords", "version"]
|
||||||
|
name = "pyadb_client"
|
||||||
|
requires-python = ">= 3.7"
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
build = ["maturin", "patchelf"]
|
||||||
|
|
||||||
|
[tool.maturin]
|
||||||
|
include = [{ path = "adb_client/**/*", format = "sdist" }]
|
||||||
|
manifest-path = "pyadb_client/Cargo.toml"
|
||||||
Reference in New Issue
Block a user