Skip to content

Commit

Permalink
Fix undiscovered boto3 names in post-install script
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Jan 10, 2020
1 parent 31520b2 commit e309223
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,16 @@ def set_cache_key() -> None:
CACHE_PATH.write_text(cache_key)


def add_package_to_index(pypi_name: str) -> None:
def add_package_to_index(boto3_name: str) -> None:
"""
Add new package to index and rebuild it if package is new.
"""
cache_key = ""
installed_boto3_names: Set[str] = {boto3_name}
if CACHE_PATH.exists():
cache_key = CACHE_PATH.read_text()

installed_pypi_names: Set[str] = {pypi_name}
for cache_key_pypi_name in cache_key.split(','):
installed_pypi_names.add(cache_key_pypi_name)
installed_boto3_names.update(CACHE_PATH.read_text().split(','))

for submodule in SUBMODULES:
if submodule.pypi_name in installed_pypi_names:
if submodule.boto3_name in installed_boto3_names:
submodule.is_installed = True

build_index()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PostInstallCommand(install):
print("{{ master_module_name }}: Running post-install script for {{ package.pypi_name }}")
try:
from {{ master_module_name }}.main import add_package_to_index
add_package_to_index("{{ package.pypi_name }}")
add_package_to_index("{{ package.boto3_name }}")
print("{{ master_module_name }}: Package {{ package.pypi_name }} added to index")
except Exception as e:
print("{{ master_module_name }}: Package index update failed for {{ package.pypi_name }}:", e)
Expand Down

0 comments on commit e309223

Please sign in to comment.