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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ venv
.venv
test_result.xml
.python-version
test_result_async.xml
.venv/
build/
*.orig
92 changes: 69 additions & 23 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,38 +1,84 @@
======================
Pure Python ADB Reborn
======================

Pure Python ADB was originially created by `@swind`_.
When it was no longer being maintained, it was forked to create Pure Python ADB Reborn.

1.0.0
-----
* Fixes #6: Fix looping in uninstall if uninstall fails due to device admin
* Fixes swind#111: Invalid escape sequence via `@eamanu`_ and `@mib1185`_
* Fixes swind#110: Add ability to pass extra arguments to ``screencap`` commands for waydroid via `@CloCkWeRX`_
* Fixes swind#88: Missing return in ``ppadb.command.transport`` : ``Transport.shell()`` for custom handler via `@roxen`_
* Fixes swind#60: Close socket if the connection fails via `@JeffLIrion`_
* Fixes swind#64: ADB reverse command via `@Hamz-a`_
* Fixes swind#92: incorrect timestamp type in asynchronous push via `@slicen`_ and `@GeekDuanLian`_
* Adds #2: Pull directory via `@ACButcher`_
* Adds swind#65: Added support to remove reverses via `@Hamz-a`_
* Adds swind#67: asynchronous install and uninstall commands via `@slicen`_
* Adds swind#85: Include LICENSE in pip package via `@jan-janssen`_
* Adds swind#57: Recursive directory push for DeviceAsync class via `@JeffLIrion`_
* Adds swind#89: Call disable-user if app is device-admin via `@eybisi`_
* Change swind#94: Device#install and DeviceAsync#install changes param from ``grand_all_permissions`` to ``grant_all_permissions``


Pure Python ADB (Legacy)
========================

0.3.0 (Unreleased)
--------------------

* Fixes #111: Invalid escape sequence via @eamanu and @mib1185
* Fixes #110: Add ability to pass extra arguments to `screencap` commands for waydroid via @CloCkWeRX
* Fixes #88: Missing return in ppadb.command.transport: Transport.shell() for custom handler via @roxen
* Fixes #60: Close socket if the connection fails via @JeffLIrion
* Fixes #64: ADB reverse command via @Hamz-a
* Fixes #92: incorrect timestamp type in asynchronous push via @slicen and @GeekDuanLian
* Adds #65: Added support to remove reverses via @Hamz-a
* Adds #67: asynchronous install and uninstall commands via @slicen
* Adds #85: Include LICENSE in pip package via @jan-janssen
* Adds #57: Recursive directory push for DeviceAsync class via @JeffLIrion
* Adds #89: Call disable-user if app is device-admin via @eybisi
* Change #94: Device#install and DeviceAsync#install changes param from `grand_all_permissions` to `grant_all_permissions`
------------------

* Fixes swind#53: Check length of screenshot before indexing into it `@JeffLIrion`_
* Adds swind#47: Async support `@JeffLIrion`_

0.2.1 (2019-10-14)
--------------------
------------------

* Fixes #21: Rename the package name from "adb" to "ppadb"
* Fixes #23: Support push dir to device
* Fixes #25: Don't call logging.basicConfig() in the module
* Fixes swind#21: Rename the package name from "adb" to "ppadb"
* Fixes swind#23: Support push dir to device
* Fixes swind#25: Don't call logging.basicConfig() in the module


0.1.6 (2019-01-21)
-------------------
------------------

* Fix #4 push does not preserve original timestap unlike equiv adb push from command line
* Fix #6 forward_list should also check serial
* Fix #8: adb/command/host/__init__.py can take an exception parsing "devices" data
* Fix swind#4: push does not preserve original timestap unlike equiv adb push from command line
* Fix swind#6: forward_list should also check serial
* Fix swind#8: adb/command/host/__init__.py can take an exception parsing "devices" data


0.1.0 (2018-06-23)
-------------------
------------------

* First release on PyPI.


Contributors
============

*`@ACButcher`_
*`@CloCkWeRX`_
*`@eamanu`_
*`@eybisi`_
*`@GeekDuanLian`_
*`@Hamz-a`_
*`@jan-janssen`_
*`@JeffLIrion`_
*`@mib1185`_
*`@roxen`_
*`@slicen`_
*`@swind`_

.. _@ACButcher: https://githib.com/ACButcher
.. _@CloCkWeRX: https://github.com/CloCkWeRX
.. _@eamanu: https://github.com/eamanu
.. _@eybisi: https://github.com/eybisi
.. _@GeekDuanLian: https://github.com/GeekDuanLian
.. _@Hamz-a: https://github.com/Hamz-a
.. _@jan-janssen: https://github.com/jan-janssen
.. _@JeffLIrion: https://github.com/JeffLIrion
.. _@mib1185: https://github.com/mib1185
.. _@roxen: https://github.com/roxen
.. _@slicen: https://github.com/slicen
.. _@swind: https://github.com/swind
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
This package is a fork of ppadb (https://github.com/swind/pure-python-adb)
Pure Python ADB Reborn
=========================================================
This package is a fork of Pure Python ADB (https://github.com/swind/pure-python-adb)
Pure Python ADB was not being maintained, so it was forked to give new life to it.

As such, it has been renamed to ppadb-reborn on PyPi.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
environment:
- PYTHONPATH=/code
- PYTHONUNBUFFERED=0
command: sh -c "pip install -r requirements.txt;py.test test -s -v --junit-xml test_result.xml;py.test test_async -s -v --junit-xml test_result_async.xml;"
command: sh -c "pip install .[dev];py.test test -s -v --junit-xml test_result.xml;py.test test_async -s -v --junit-xml test_result_async.xml;"

emulator:
image: swind/android-emulator:android_28
Expand Down
3 changes: 0 additions & 3 deletions ppadb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
__version__ = "0.3.0-dev"


class InstallError(Exception):
def __init__(self, path, error):
super(InstallError, self).__init__(
Expand Down
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = [
"setuptools>=64",
"setuptools-scm>=8"
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
exclude = ["*.test", "*.test.*", "test.*", "test"]

[project]
name = "pure-python-adb-reborn"
maintainers = [
{name = "Sergio Martins"},
{name = "Andrew Butcher"},
]
description = "Pure python implementation of the adb client."
dynamic = [
"dependencies",
"version"
]
license = {text = "MIT"}
readme = "README.rst"
requires-python = ">= 3.12"

keywords = [
"adb",
"android",
"async",
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Testing',
]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools_scm]
fallback_version=">0.3.0"
normalize=false

[project.urls]
Repository = "https://github.com/spm5065/pure-python-adb.git"
Issues = "https://github.com/spm5065/pure-python-adb/issues"
Changelog = "https://github.com/spm5065/pure-python-adb/blob/master/HISTORY.rst"
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
pytest
Exscript
aiofiles >= 0.4.0

# Dev
pytest[dev]
black[dev]
ruff[dev]
36 changes: 0 additions & 36 deletions setup.py

This file was deleted.

56 changes: 35 additions & 21 deletions test_async/test_device_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ def progress(*args, **kwargs):
pass

filedata = b"Ohayou sekai.\nGood morning world!"
with patch("os.path.exists", return_value=True), patch(
"os.path.isfile", return_value=True
), patch("os.stat", return_value=os.stat_result((123,) * 10)), patch(
"ppadb.sync_async.aiofiles.open", async_mock_open(FILEDATA)
with (
patch("os.path.exists", return_value=True),
patch("os.path.isfile", return_value=True),
patch("os.stat", return_value=os.stat_result((123,) * 10)),
patch("ppadb.sync_async.aiofiles.open", async_mock_open(FILEDATA)),
):
with async_patch(
"asyncio.open_connection",
Expand All @@ -123,24 +124,34 @@ def progress(*args, **kwargs):

@awaiter
async def test_push_dir(self):
with patch("pathlib.Path.exists", return_value=True), patch(
"os.path.isfile", return_value=False
), patch("os.path.isdir", return_value=True), patch(
"os.walk",
return_value=[("root1", "dirs1", "files1"), ("root2", "dirs2", "files2")],
with (
patch("pathlib.Path.exists", return_value=True),
patch("os.path.isfile", return_value=False),
patch("os.path.isdir", return_value=True),
patch(
"os.walk",
return_value=[
("root1", "dirs1", "files1"),
("root2", "dirs2", "files2"),
],
),
):
with async_patch("ppadb.device_async.DeviceAsync.shell"), async_patch(
"ppadb.device_async.DeviceAsync._push"
with (
async_patch("ppadb.device_async.DeviceAsync.shell"),
async_patch("ppadb.device_async.DeviceAsync._push"),
):
await self.device.push("src", "dest")

@awaiter
async def test_pull(self):
with async_patch(
"asyncio.open_connection",
return_value=(FakeStreamReader(), FakeStreamWriter()),
), async_patch(
"ppadb.device_async.DeviceAsync.shell", return_value=["", "IS_FILE"]
with (
async_patch(
"asyncio.open_connection",
return_value=(FakeStreamReader(), FakeStreamWriter()),
),
async_patch(
"ppadb.device_async.DeviceAsync.shell", return_value=["", "IS_FILE"]
),
):
with async_patch(
"{}.FakeStreamReader.read".format(__name__),
Expand All @@ -159,11 +170,14 @@ async def test_pull(self):

@awaiter
async def test_pull_fail(self):
with async_patch(
"asyncio.open_connection",
return_value=(FakeStreamReader(), FakeStreamWriter()),
), async_patch(
"ppadb.device_async.DeviceAsync.shell", return_value=["", "IS_FILE"]
with (
async_patch(
"asyncio.open_connection",
return_value=(FakeStreamReader(), FakeStreamWriter()),
),
async_patch(
"ppadb.device_async.DeviceAsync.shell", return_value=["", "IS_FILE"]
),
):
with async_patch(
"{}.FakeStreamReader.read".format(__name__),
Expand Down