Skip to content

Commit

Permalink
Merge 654c45f into ba3fb4b
Browse files Browse the repository at this point in the history
  • Loading branch information
KOLANICH committed May 29, 2022
2 parents ba3fb4b + 654c45f commit a2ecaa3
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 124 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel setuptools setuptools_scm
if python --version 2>&1 | grep -q "Python 2"; then pip install mock rsa==4.0 libusb1==1.9.3; fi
python -m pip install flake8 pylint coveralls cryptography libusb1>=1.0.16 pycryptodome
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
python -m build -nwsx .;
pip install ./dist/*.whl;
if python --version 2>&1 | grep -q "Python 3.7" || python --version 2>&1 | grep -q "Python 3.8" || python --version 2>&1 | grep -q "Python 3.9" || python --version 2>&1 | grep -q "Python 3.10"; then pip install aiofiles; fi
- name: Lint with pylint and flake8
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Autogenerated version file
/adb_shell/version.py

# Python files
*.idea
*.pyc
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ addons:
- swig
- libusb-1.0-0-dev
install:
- pip install .
- pip install --upgrade pip
- pip install --upgrade build
- python -m build -nwx .
- pip install ./dist/*.whl
- pip install flake8 pylint coveralls cryptography libusb1>=1.0.16 pycryptodome
- python --version 2>&1 | grep -q "Python 2" && pip install mock || true
- if python --version 2>&1 | grep -q "Python 3.7" || python --version 2>&1 | grep -q "Python 3.8" || python --version 2>&1 | grep -q "Python 3.9"; then pip install aiofiles; fi
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ release:
rm -rf dist
rm -rf build
scripts/git_tag.sh
python setup.py sdist bdist_wheel
python -m build -nwsx
twine upload dist/*

.PHONY: docs
Expand Down
2 changes: 1 addition & 1 deletion adb_shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"""


__version__ = '0.4.2'
from .version import __version__ # noqa: F401
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "adb_shell/version.py"
write_to_template = "'''Generated by setuptools_scm'''\n__version__ = '{version}'\n"
35 changes: 0 additions & 35 deletions scripts/bumpversion.sh

This file was deleted.

45 changes: 45 additions & 0 deletions scripts/get_package_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
import sys
import typing
from pathlib import Path

import tomli

__license__ = "Unlicense"
__copyright__ = """
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org/>
"""


def getPackageName(rootDir: Path) -> str:
from setuptools.config import read_configuration

setupCfg = read_configuration(Path(rootDir / "setup.cfg"))
try:
return setupCfg["metadata"]["name"]
except KeyError:
return None


def main():
if len(sys.argv) > 1:
p = sys.argv[1]
else:
p = "."
pn = getPackageName(Path(p))
if pn:
print(pn, file=sys.stdout)
else:
print("Package name could not be determined", file=sys.stderr)


if __name__ == "__main__":
main()
22 changes: 0 additions & 22 deletions scripts/get_package_name.sh

This file was deleted.

15 changes: 15 additions & 0 deletions scripts/get_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python3
import sys

__license__ = "Unlicense"

if __name__ == "__main__":
import setuptools_scm

v = setuptools_scm.get_version(local_scheme="no-local-version").rsplit(".", 1)
if not v:
print("Version could not be determined", file=sys.stderr)
sys.exit(1)
if v[-1].startswith("dev"):
v = v[:-1]
print(".".join(v))
26 changes: 0 additions & 26 deletions scripts/get_version.sh

This file was deleted.

6 changes: 1 addition & 5 deletions scripts/git_retag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
# get the directory of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# get the package name
PACKAGE=$($DIR/get_package_name.sh)

# get the current version
VERSION=$($DIR/get_version.sh)

VERSION=$(python3 $DIR/get_version.py)

# Announce the tag
echo "Re-tagging v$VERSION"
Expand Down
6 changes: 1 addition & 5 deletions scripts/git_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
# get the directory of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# get the package name
PACKAGE=$($DIR/get_package_name.sh)

# get the current version
VERSION=$($DIR/get_version.sh)

VERSION=$(python3 $DIR/get_version.py)

# Announce the tag
echo "Creating tag v$VERSION"
Expand Down
6 changes: 3 additions & 3 deletions scripts/rename_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# get the current package name
PACKAGE=$($DIR/get_package_name.sh)
PACKAGE=$(python3 $DIR/get_package_name.py)

# Announce the renaming
echo "Renaming from '$PACKAGE' to '$1'"
Expand All @@ -32,8 +32,8 @@ sed -i "s|$PACKAGE|$1|g" $DIR/../Doxyfile
# Makefile
sed -i "s|$PACKAGE|$1|g" $DIR/../Makefile

# setup.py
sed -i "s|$PACKAGE|$1|g" $DIR/../setup.py
# setup.cfg
sed -i "s|$PACKAGE|$1|g" $DIR/../setup.cfg

# docs/Makefile
sed -i "s|$PACKAGE|$1|g" $DIR/../docs/Makefile
Expand Down
29 changes: 29 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[metadata]
name = adb_shell
author = Jeff Irion
author_email = jefflirion@users.noreply.github.com
description = A Python implementation of ADB with shell and FileSync functionality.
license = Apache-2.0
keywords = adb, android
url = https://github.com/JeffLIrion/adb_shell
long_description = file: README.rst
long_description_content_type = text/x-rst
classifiers =
Operating System :: OS Independent
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 3
Programming Language :: Python :: 2

[options]
install_requires = cryptography; pyasn1; rsa
packages = adb_shell, adb_shell.auth, adb_shell.transport

[options.extras_require]
usb = libusb1>=1.0.16
async = aiofiles>=0.4.0
testing = pycryptodome; libusb1>=1.0.16

[tool.setuptools]

[distutils.bdist_wheel]
universal = 1
24 changes: 0 additions & 24 deletions setup.py

This file was deleted.

0 comments on commit a2ecaa3

Please sign in to comment.