diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 8804411..b1c1098 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -42,21 +42,15 @@ jobs: python -m pip install isort isort . -m HANGING_INDENT -l 120 --check-only - name: Build - # TODO: remove when lief releases the 3.12 wheel (https://github.com/lief-project/LIEF/issues/990) - if: matrix.python-version != 3.12 run: | python3 -m pip install mypy-protobuf protobuf grpcio-tools make -C ../protos/ python_protos python -m pip install build python3 -m build - name: Install - # TODO: remove when lief releases the 3.12 wheel (https://github.com/lief-project/LIEF/issues/990) - if: matrix.python-version != 3.12 run: | python3 -m pip install . - name: Run help - # TODO: remove when lief releases the 3.12 wheel (https://github.com/lief-project/LIEF/issues/990) - if: matrix.python-version != 3.12 run: | python3 -m rpcclient --help @@ -124,10 +118,9 @@ jobs: - os: macos-latest arch: arm64 python-version: "3.11" - # TODO: remove when lief releases the 3.12 wheel (https://github.com/lief-project/LIEF/issues/990) - # - os: macos-latest - # arch: arm64 - # python-version: "3.12" + - os: macos-latest + arch: arm64 + python-version: "3.12" - os: macos-latest arch: x86_64 @@ -141,10 +134,9 @@ jobs: - os: macos-latest arch: x86_64 python-version: "3.11" - # TODO: remove when lief releases the 3.12 wheel (https://github.com/lief-project/LIEF/issues/990) - # - os: macos-latest - # arch: x86_64 - # python-version: "3.12" + - os: macos-latest + arch: x86_64 + python-version: "3.12" steps: - uses: actions/checkout@v4 diff --git a/src/rpcclient/rpcclient/client.py b/src/rpcclient/rpcclient/client.py index 874a479..c9f48c9 100644 --- a/src/rpcclient/rpcclient/client.py +++ b/src/rpcclient/rpcclient/client.py @@ -434,6 +434,7 @@ def shell(self, reuse_client: bool = False): try: logging.getLogger('parso.python.diff').disabled = True logging.getLogger('parso.cache').disabled = True + logging.getLogger('asyncio').disabled = True xonsh_main(args) except SystemExit: self._logger.disabled = False diff --git a/src/rpcclient/rpcclient/fs.py b/src/rpcclient/rpcclient/fs.py index f0711d6..6edcf37 100644 --- a/src/rpcclient/rpcclient/fs.py +++ b/src/rpcclient/rpcclient/fs.py @@ -205,11 +205,16 @@ def __repr__(self): class RemotePath(PosixPath): def __init__(self, path: str, client) -> None: - super().__init__() + try: + super().__init__(path) # solution from python3.12 since signature has changed + except TypeError: + super().__init__() + self._path = path self._client = client def __new__(cls, path: str, client): + # this will not be needed once python3.11 is deprecated since it is now possible to subclass normally return super().__new__(cls, *[path]) def chmod(self, mode: int): @@ -285,7 +290,7 @@ def _cp(self, sources: List[Path], dest: Path, recursive: bool, force: bool): dest_exists = dest.exists() is_dest_dir = dest_exists and dest.is_dir() - if ((not dest_exists or not is_dest_dir) and len(sources) > 1): + if (not dest_exists or not is_dest_dir) and (len(sources) > 1): raise ArgumentError(f'target {dest} is not a directory') if recursive: @@ -481,21 +486,23 @@ def read_file(self, file: str) -> bytes: def _remote_path(self, path: str) -> RemotePath: return RemotePath(path, self._client) - @path_to_str('remotes') @path_to_str('local') - def pull(self, remotes: Union[List[str], str], local: str, recursive: bool = False, force: bool = False): + def pull(self, remotes: Union[List[Union[str, Path]], Union[str, Path]], local: str, recursive: bool = False, + force: bool = False): """ pull complete directory tree """ if not isinstance(remotes, list): remotes = [remotes] - self._cp([self._remote_path(remote) for remote in remotes], Path(str(local)), recursive, force) + remotes_str = [str(remote) for remote in remotes] + self._cp([self._remote_path(remote) for remote in remotes_str], Path(str(local)), recursive, force) - @path_to_str('locals') @path_to_str('remote') - def push(self, locals: Union[List[str], str], remote: str, recursive: bool = False, force: bool = False): + def push(self, locals: Union[List[Union[str, Path]], Union[str, Path]], remote: str, recursive: bool = False, + force: bool = False): """ push complete directory tree """ if not isinstance(locals, list): locals = [locals] - self._cp([Path(str(local)) for local in locals], self._remote_path(remote), recursive, force) + locals_str = [str(local) for local in locals] + self._cp([Path(str(local)) for local in locals_str], self._remote_path(remote), recursive, force) @path_to_str('file') def touch(self, file: str, mode: int = None):