diff --git a/Makefile b/Makefile index 11cf193bf95dd7592e8efded0504dbe551a3e896..f075c63cd75de0870d561ec81073a15fe976d0e8 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ clean-build: rm -fr dist/ rm -fr .eggs/ find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + + find . -name '*.egg' -exec rm -f {} + || true clean-pyc: find . -name '*.pyc' -exec rm -f {} + @@ -51,6 +51,7 @@ lint: install-build-requirements generate: clean-proto install-build-requirements find $(PROTO_FILES_DIR) -name '*.proto' -exec python3 -m grpc_tools.protoc -I${PROTO_FILES_DIR} --python_out=$(OUTPUT_FILES_DIR) --grpc_python_out=$(OUTPUT_FILES_DIR) {} + + python fix_imports.py dist: clean generate python setup.py sdist diff --git a/build-requirements.txt b/build-requirements.txt index 086628457a5b3bf64af39afa9f3375a5a0fd528e..8ced1d98afe17f6659f14c956b0c761edaaf9daf 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -1,35 +1,35 @@ appdirs==1.4.4 backports.entry-points-selectable==1.2.0 -bleach==5.0.1 -build==0.9.0 +bleach==6.0.0 +build==0.10.0 certifi==2022.9.24 chardet==5.0.0 charset-normalizer==2.0.12 -check-manifest==0.48 +check-manifest==0.49 colorama==0.4.6 distlib==0.3.6 -docutils==0.19 -filelock==3.8.0 -flake8==5.0.4 +docutils==0.20.1 +filelock==3.12.2 +flake8==6.0.0 grpcio==1.50.0 grpcio-tools==1.43.0 idna==3.4 -importlib-metadata==5.0.0 -keyring==23.11.0 +importlib-metadata==6.7.0 +keyring==24.1.0 lazy==1.5 mccabe==0.7.0 -packaging==21.3 +packaging==23.1 pep517==0.13.0 -pkginfo==1.8.3 -platformdirs==2.5.4 -pluggy==1.0.0 +pkginfo==1.9.6 +platformdirs==3.8.0 +pluggy==1.2.0 protobuf==3.19.4 py==1.11.0 -pycodestyle==2.9.1 -pyflakes==2.5.0 -Pygments==2.13.0 -pyparsing==3.0.9 -readme-renderer==37.3 +pycodestyle==2.10.0 +pyflakes==3.0.1 +Pygments==2.15.1 +pyparsing==3.1.0 +readme-renderer==40.0 requests==2.28.1 requests-toolbelt==0.10.1 rfc3986==2.0.0 @@ -37,10 +37,10 @@ six==1.16.0 toml==0.10.2 tomli==2.0.1 tox==3.27.1 -tqdm==4.64.1 -twine==4.0.1 -typing_extensions==4.4.0 +tqdm==4.65.0 +twine==4.0.2 +typing_extensions==4.6.3 urllib3==1.26.12 -virtualenv==20.16.7 +virtualenv==20.23.1 webencodings==0.5.1 -zipp==3.10.0 +zipp==3.15.0 diff --git a/fix_imports.py b/fix_imports.py new file mode 100644 index 0000000000000000000000000000000000000000..982a16dda1db3269b2ad2458fc694bcf2d2faf06 --- /dev/null +++ b/fix_imports.py @@ -0,0 +1,31 @@ +import re +import os + +from pathlib import Path + + +REGEXP = re.compile( + r"(from )" + r"(" + r"clients|collaborators|collections|common|delivery|environments|extensions|files|images|invitations" + r"|items|locales|members|organizations|references|roles|spaces|status|users|versions.+|" + r")" + r"( import.*pb2)" +) +PERXIS_DIR_NAME = "perxis" +PERXIS_DIR_PATH = (Path(__file__).parent.absolute()).joinpath(PERXIS_DIR_NAME) + + +def main(): + for path, _, files in os.walk(PERXIS_DIR_PATH): + for name in files: + file_path = os.path.join(path, name) + with open(file_path, "r+") as f: + text = f.read() + result = re.sub(REGEXP, rf"\1{PERXIS_DIR_NAME}.\2\3", text) + f.seek(0) + f.write(result) + + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt index 04f0ac14bb782d8f94e969b7529073e734ab6a21..037b5b3ed1043d3f0ba286fb106ff72117e98cae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ grpcio==1.50.0 idna==3.4 oauthlib==3.2.2 protobuf==3.19.4 -PyJWT==2.6.0 +PyJWT==2.7.0 requests==2.28.1 requests-oauthlib==1.3.1 six==1.16.0