Skip to content
Snippets Groups Projects
Commit b15ad07b authored by Eterevskiy Georgiy's avatar Eterevskiy Georgiy
Browse files

Merge branch 'bugfix/import_errors' into 'master'

Реализован скрипт замены некорректных импортов

See merge request perxis/perxis-python!29
parents 38fdb61e 05785b45
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ clean-build: ...@@ -23,7 +23,7 @@ clean-build:
rm -fr dist/ rm -fr dist/
rm -fr .eggs/ rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} + find . -name '*.egg' -exec rm -f {} + || true
clean-pyc: clean-pyc:
find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyc' -exec rm -f {} +
...@@ -51,6 +51,7 @@ lint: install-build-requirements ...@@ -51,6 +51,7 @@ lint: install-build-requirements
generate: clean-proto 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) {} + 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 dist: clean generate
python setup.py sdist python setup.py sdist
......
appdirs==1.4.4 appdirs==1.4.4
backports.entry-points-selectable==1.2.0 backports.entry-points-selectable==1.2.0
bleach==5.0.1 bleach==6.0.0
build==0.9.0 build==0.10.0
certifi==2022.9.24 certifi==2022.9.24
chardet==5.0.0 chardet==5.0.0
charset-normalizer==2.0.12 charset-normalizer==2.0.12
check-manifest==0.48 check-manifest==0.49
colorama==0.4.6 colorama==0.4.6
distlib==0.3.6 distlib==0.3.6
docutils==0.19 docutils==0.20.1
filelock==3.8.0 filelock==3.12.2
flake8==5.0.4 flake8==6.0.0
grpcio==1.50.0 grpcio==1.50.0
grpcio-tools==1.43.0 grpcio-tools==1.43.0
idna==3.4 idna==3.4
importlib-metadata==5.0.0 importlib-metadata==6.7.0
keyring==23.11.0 keyring==24.1.0
lazy==1.5 lazy==1.5
mccabe==0.7.0 mccabe==0.7.0
packaging==21.3 packaging==23.1
pep517==0.13.0 pep517==0.13.0
pkginfo==1.8.3 pkginfo==1.9.6
platformdirs==2.5.4 platformdirs==3.8.0
pluggy==1.0.0 pluggy==1.2.0
protobuf==3.19.4 protobuf==3.19.4
py==1.11.0 py==1.11.0
pycodestyle==2.9.1 pycodestyle==2.10.0
pyflakes==2.5.0 pyflakes==3.0.1
Pygments==2.13.0 Pygments==2.15.1
pyparsing==3.0.9 pyparsing==3.1.0
readme-renderer==37.3 readme-renderer==40.0
requests==2.28.1 requests==2.28.1
requests-toolbelt==0.10.1 requests-toolbelt==0.10.1
rfc3986==2.0.0 rfc3986==2.0.0
...@@ -37,10 +37,10 @@ six==1.16.0 ...@@ -37,10 +37,10 @@ six==1.16.0
toml==0.10.2 toml==0.10.2
tomli==2.0.1 tomli==2.0.1
tox==3.27.1 tox==3.27.1
tqdm==4.64.1 tqdm==4.65.0
twine==4.0.1 twine==4.0.2
typing_extensions==4.4.0 typing_extensions==4.6.3
urllib3==1.26.12 urllib3==1.26.12
virtualenv==20.16.7 virtualenv==20.23.1
webencodings==0.5.1 webencodings==0.5.1
zipp==3.10.0 zipp==3.15.0
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()
...@@ -5,7 +5,7 @@ grpcio==1.50.0 ...@@ -5,7 +5,7 @@ grpcio==1.50.0
idna==3.4 idna==3.4
oauthlib==3.2.2 oauthlib==3.2.2
protobuf==3.19.4 protobuf==3.19.4
PyJWT==2.6.0 PyJWT==2.7.0
requests==2.28.1 requests==2.28.1
requests-oauthlib==1.3.1 requests-oauthlib==1.3.1
six==1.16.0 six==1.16.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment