Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc909ceda6 | ||
|
|
cbba912483 | ||
|
|
38d8384b98 | ||
|
|
39591b6a0a | ||
|
|
775b2421ec |
53
.github/workflows/python-build.yml
vendored
53
.github/workflows/python-build.yml
vendored
@@ -1,20 +1,43 @@
|
||||
name: Python - Build
|
||||
name: Python - Build packages & Release
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
on:
|
||||
push: {}
|
||||
pull_request: {}
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build-release-python:
|
||||
name: "build-release-python"
|
||||
build-python-packages:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: pyadb_client
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Python dependencies
|
||||
run: pip install .
|
||||
- name: Build project
|
||||
run: maturin build --release
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python build dependencies
|
||||
run: pip install ".[build]"
|
||||
|
||||
- name: Build Python packages
|
||||
run: maturin build --release --compatibility manylinux_2_25 --auditwheel=skip
|
||||
|
||||
publish-python-packages:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-python-packages]
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python build dependencies
|
||||
run: pip install ".[build]"
|
||||
|
||||
- name: Publish Python packages
|
||||
run: maturin publish --non-interactive --compatibility manylinux_2_25 --auditwheel=skip
|
||||
env:
|
||||
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
|
||||
|
||||
- name: "Publish GitHub artefacts"
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
target/wheels/pyadb_client*.whl
|
||||
target/wheels/pyadb_client*.tar.gz
|
||||
30
.github/workflows/python-release.yml
vendored
30
.github/workflows/python-release.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: Rust - Release creation
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: pyadb_client
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: pip install .
|
||||
|
||||
- name: Publish Python package
|
||||
run: maturin publish --non-interactive
|
||||
env:
|
||||
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
|
||||
|
||||
- name: "Publish GitHub artefacts"
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
target/wheels/pyadb_client*.whl
|
||||
target/wheels/pyadb_client*.tar.gz
|
||||
@@ -9,7 +9,7 @@ homepage = "https://github.com/cocool97/adb_client"
|
||||
keywords = ["adb", "android", "tcp", "usb"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/cocool97/adb_client"
|
||||
version = "2.1.1"
|
||||
version = "2.1.5"
|
||||
|
||||
# To build locally when working on a new release
|
||||
[patch.crates-io]
|
||||
|
||||
@@ -17,4 +17,4 @@ crate-type = ["cdylib"]
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.94" }
|
||||
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.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install pyadb_client
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Use ADB server
|
||||
|
||||
```python
|
||||
from pyadb_client import pyadb_client
|
||||
|
||||
server = pyadb_client.PyADBServer("127.0.0.1:5037")
|
||||
for i, device in enumerate(server.devices()):
|
||||
print(i, device.identifier, device.state)
|
||||
@@ -19,6 +27,8 @@ print(device, device.identifier)
|
||||
### Push a file on device
|
||||
|
||||
```python
|
||||
from pyadb_client import pyadb_client
|
||||
|
||||
usb_device = PyADBUSBDevice.autodetect()
|
||||
usb_device.push("file.txt", "/data/local/tmp/file.txt")
|
||||
```
|
||||
@@ -31,14 +41,12 @@ cd pyadb_client
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
# Install needed dependencies
|
||||
pip install -e .
|
||||
# Install needed build dependencies
|
||||
pip install ".[build]"
|
||||
|
||||
# Build development package
|
||||
maturin develop
|
||||
|
||||
# Build release Python package
|
||||
maturin build --release
|
||||
|
||||
# Publish Python package
|
||||
```
|
||||
```
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
[build-system]
|
||||
requires = ["maturin>=1,<2"]
|
||||
build-backend = "maturin"
|
||||
|
||||
[project]
|
||||
dependencies = ["maturin", "patchelf"]
|
||||
name = "pyadb_client"
|
||||
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