diff --git a/app/build_containers.py b/app/build_containers.py index c74df1e9..3e8bb140 100644 --- a/app/build_containers.py +++ b/app/build_containers.py @@ -24,7 +24,8 @@ import os from decouple import config import subprocess import click -import pkg_resources +import importlib +from pathlib import Path from .util import include_exclude_check # TODO: find a place for this @@ -43,8 +44,8 @@ def command(ctx, include, exclude): dry_run = ctx.obj.dry_run local_stack = ctx.obj.local_stack - # TODO: check this still works in the shiv package scenario - container_build_dir = os.path.join(os.getcwd(), "container-build") + # See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure + container_build_dir = Path(__file__).absolute().parent.joinpath("data", "container-build") if local_stack: dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")] @@ -58,8 +59,10 @@ def command(ctx, include, exclude): if not os.path.isdir(dev_root_path): print('Dev root directory doesn\'t exist, creating') - with pkg_resources.resource_stream(__name__, "data/container-image-list.txt") as container_list_file: - containers = container_list_file.read().decode().splitlines() + # See: https://stackoverflow.com/a/20885799/1701505 + from . import data + with importlib.resources.open_text(data, "container-image-list.txt") as container_list_file: + containers = container_list_file.read().splitlines() if verbose: print(f'Containers: {containers}') @@ -88,7 +91,7 @@ def command(ctx, include, exclude): # Check if we have a repo for this container. If not, set the context dir to the container-build subdir repo_full_path = os.path.join(dev_root_path, repo_dir) repo_dir_or_build_dir = repo_dir if os.path.exists(repo_full_path) else build_dir - build_command = os.path.join("container-build", "default-build.sh") + f" {container} {repo_dir_or_build_dir}" + build_command = os.path.join(container_build_dir, "default-build.sh") + f" {container} {repo_dir_or_build_dir}" if not dry_run: if verbose: print(f"Executing: {build_command}") diff --git a/app/build_npms.py b/app/build_npms.py index e00c0734..905a54cd 100644 --- a/app/build_npms.py +++ b/app/build_npms.py @@ -21,7 +21,7 @@ import os from decouple import config import click -import pkg_resources +import importlib from python_on_whales import docker from .util import include_exclude_check @@ -50,8 +50,10 @@ def command(ctx, include, exclude): if not os.path.isdir(dev_root_path): print('Dev root directory doesn\'t exist, creating') - with pkg_resources.resource_stream(__name__, "data/npm-package-list.txt") as package_list_file: - packages = package_list_file.read().decode().splitlines() + # See: https://stackoverflow.com/a/20885799/1701505 + from . import data + with importlib.resources.open_text(data, "npm-package-list.txt") as package_list_file: + packages = package_list_file.read().splitlines() if verbose: print(f'Packages: {packages}') diff --git a/app/data/__init__.py b/app/data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/compose/docker-compose-contract.yml b/app/data/compose/docker-compose-contract.yml similarity index 100% rename from compose/docker-compose-contract.yml rename to app/data/compose/docker-compose-contract.yml diff --git a/compose/docker-compose-eth-probe.yml b/app/data/compose/docker-compose-eth-probe.yml similarity index 100% rename from compose/docker-compose-eth-probe.yml rename to app/data/compose/docker-compose-eth-probe.yml diff --git a/compose/docker-compose-eth-statediff-fill-service.yml b/app/data/compose/docker-compose-eth-statediff-fill-service.yml similarity index 100% rename from compose/docker-compose-eth-statediff-fill-service.yml rename to app/data/compose/docker-compose-eth-statediff-fill-service.yml diff --git a/compose/docker-compose-fixturenet-eth.yml b/app/data/compose/docker-compose-fixturenet-eth.yml similarity index 100% rename from compose/docker-compose-fixturenet-eth.yml rename to app/data/compose/docker-compose-fixturenet-eth.yml diff --git a/compose/docker-compose-fixturenet-laconicd.yml b/app/data/compose/docker-compose-fixturenet-laconicd.yml similarity index 100% rename from compose/docker-compose-fixturenet-laconicd.yml rename to app/data/compose/docker-compose-fixturenet-laconicd.yml diff --git a/compose/docker-compose-go-ethereum-foundry.yml b/app/data/compose/docker-compose-go-ethereum-foundry.yml similarity index 100% rename from compose/docker-compose-go-ethereum-foundry.yml rename to app/data/compose/docker-compose-go-ethereum-foundry.yml diff --git a/compose/docker-compose-ipld-eth-beacon-db.yml b/app/data/compose/docker-compose-ipld-eth-beacon-db.yml similarity index 100% rename from compose/docker-compose-ipld-eth-beacon-db.yml rename to app/data/compose/docker-compose-ipld-eth-beacon-db.yml diff --git a/compose/docker-compose-ipld-eth-beacon-indexer.yml b/app/data/compose/docker-compose-ipld-eth-beacon-indexer.yml similarity index 100% rename from compose/docker-compose-ipld-eth-beacon-indexer.yml rename to app/data/compose/docker-compose-ipld-eth-beacon-indexer.yml diff --git a/compose/docker-compose-ipld-eth-db.yml b/app/data/compose/docker-compose-ipld-eth-db.yml similarity index 100% rename from compose/docker-compose-ipld-eth-db.yml rename to app/data/compose/docker-compose-ipld-eth-db.yml diff --git a/compose/docker-compose-ipld-eth-server.yml b/app/data/compose/docker-compose-ipld-eth-server.yml similarity index 100% rename from compose/docker-compose-ipld-eth-server.yml rename to app/data/compose/docker-compose-ipld-eth-server.yml diff --git a/compose/docker-compose-keycloak.yml b/app/data/compose/docker-compose-keycloak.yml similarity index 100% rename from compose/docker-compose-keycloak.yml rename to app/data/compose/docker-compose-keycloak.yml diff --git a/compose/docker-compose-laconicd.yml b/app/data/compose/docker-compose-laconicd.yml similarity index 100% rename from compose/docker-compose-laconicd.yml rename to app/data/compose/docker-compose-laconicd.yml diff --git a/compose/docker-compose-prometheus-grafana.yml b/app/data/compose/docker-compose-prometheus-grafana.yml similarity index 100% rename from compose/docker-compose-prometheus-grafana.yml rename to app/data/compose/docker-compose-prometheus-grafana.yml diff --git a/compose/docker-compose-test.yml b/app/data/compose/docker-compose-test.yml similarity index 100% rename from compose/docker-compose-test.yml rename to app/data/compose/docker-compose-test.yml diff --git a/compose/docker-compose-tx-spammer.yml b/app/data/compose/docker-compose-tx-spammer.yml similarity index 100% rename from compose/docker-compose-tx-spammer.yml rename to app/data/compose/docker-compose-tx-spammer.yml diff --git a/compose/docker-compose-watcher-erc20.yml b/app/data/compose/docker-compose-watcher-erc20.yml similarity index 100% rename from compose/docker-compose-watcher-erc20.yml rename to app/data/compose/docker-compose-watcher-erc20.yml diff --git a/compose/docker-compose-watcher-erc721.yml b/app/data/compose/docker-compose-watcher-erc721.yml similarity index 100% rename from compose/docker-compose-watcher-erc721.yml rename to app/data/compose/docker-compose-watcher-erc721.yml diff --git a/compose/docker-compose-watcher-mobymask.yml b/app/data/compose/docker-compose-watcher-mobymask.yml similarity index 100% rename from compose/docker-compose-watcher-mobymask.yml rename to app/data/compose/docker-compose-watcher-mobymask.yml diff --git a/compose/docker-compose-watcher-uniswap-v3.yml b/app/data/compose/docker-compose-watcher-uniswap-v3.yml similarity index 100% rename from compose/docker-compose-watcher-uniswap-v3.yml rename to app/data/compose/docker-compose-watcher-uniswap-v3.yml diff --git a/config/fixturenet-eth/fixturenet-eth.env b/app/data/config/fixturenet-eth/fixturenet-eth.env similarity index 100% rename from config/fixturenet-eth/fixturenet-eth.env rename to app/data/config/fixturenet-eth/fixturenet-eth.env diff --git a/config/fixturenet-laconicd/create-fixturenet.sh b/app/data/config/fixturenet-laconicd/create-fixturenet.sh similarity index 100% rename from config/fixturenet-laconicd/create-fixturenet.sh rename to app/data/config/fixturenet-laconicd/create-fixturenet.sh diff --git a/config/ipld-eth-beacon-indexer/indexer.env b/app/data/config/ipld-eth-beacon-indexer/indexer.env similarity index 100% rename from config/ipld-eth-beacon-indexer/indexer.env rename to app/data/config/ipld-eth-beacon-indexer/indexer.env diff --git a/config/ipld-eth-server/chain.json b/app/data/config/ipld-eth-server/chain.json similarity index 100% rename from config/ipld-eth-server/chain.json rename to app/data/config/ipld-eth-server/chain.json diff --git a/config/keycloak/import/cerc-realm.json b/app/data/config/keycloak/import/cerc-realm.json similarity index 100% rename from config/keycloak/import/cerc-realm.json rename to app/data/config/keycloak/import/cerc-realm.json diff --git a/config/keycloak/keycloak.env b/app/data/config/keycloak/keycloak.env similarity index 100% rename from config/keycloak/keycloak.env rename to app/data/config/keycloak/keycloak.env diff --git a/config/keycloak/nginx/keycloak_proxy.conf b/app/data/config/keycloak/nginx/keycloak_proxy.conf similarity index 100% rename from config/keycloak/nginx/keycloak_proxy.conf rename to app/data/config/keycloak/nginx/keycloak_proxy.conf diff --git a/config/postgresql/create-pg-stat-statements.sql b/app/data/config/postgresql/create-pg-stat-statements.sql similarity index 100% rename from config/postgresql/create-pg-stat-statements.sql rename to app/data/config/postgresql/create-pg-stat-statements.sql diff --git a/config/postgresql/multiple-postgressql-databases.sh b/app/data/config/postgresql/multiple-postgressql-databases.sh similarity index 100% rename from config/postgresql/multiple-postgressql-databases.sh rename to app/data/config/postgresql/multiple-postgressql-databases.sh diff --git a/config/tx-spammer/tx-spammer.env b/app/data/config/tx-spammer/tx-spammer.env similarity index 100% rename from config/tx-spammer/tx-spammer.env rename to app/data/config/tx-spammer/tx-spammer.env diff --git a/config/watcher-erc20/erc20-watcher.toml b/app/data/config/watcher-erc20/erc20-watcher.toml similarity index 100% rename from config/watcher-erc20/erc20-watcher.toml rename to app/data/config/watcher-erc20/erc20-watcher.toml diff --git a/config/watcher-erc721/erc721-watcher.toml b/app/data/config/watcher-erc721/erc721-watcher.toml similarity index 100% rename from config/watcher-erc721/erc721-watcher.toml rename to app/data/config/watcher-erc721/erc721-watcher.toml diff --git a/config/watcher-mobymask/mobymask-watcher-db.sql b/app/data/config/watcher-mobymask/mobymask-watcher-db.sql similarity index 100% rename from config/watcher-mobymask/mobymask-watcher-db.sql rename to app/data/config/watcher-mobymask/mobymask-watcher-db.sql diff --git a/config/watcher-mobymask/mobymask-watcher.toml b/app/data/config/watcher-mobymask/mobymask-watcher.toml similarity index 100% rename from config/watcher-mobymask/mobymask-watcher.toml rename to app/data/config/watcher-mobymask/mobymask-watcher.toml diff --git a/config/watcher-uniswap-v3/erc20-watcher.toml b/app/data/config/watcher-uniswap-v3/erc20-watcher.toml similarity index 100% rename from config/watcher-uniswap-v3/erc20-watcher.toml rename to app/data/config/watcher-uniswap-v3/erc20-watcher.toml diff --git a/config/watcher-uniswap-v3/run.sh b/app/data/config/watcher-uniswap-v3/run.sh similarity index 100% rename from config/watcher-uniswap-v3/run.sh rename to app/data/config/watcher-uniswap-v3/run.sh diff --git a/config/watcher-uniswap-v3/uni-info-watcher.toml b/app/data/config/watcher-uniswap-v3/uni-info-watcher.toml similarity index 100% rename from config/watcher-uniswap-v3/uni-info-watcher.toml rename to app/data/config/watcher-uniswap-v3/uni-info-watcher.toml diff --git a/config/watcher-uniswap-v3/uni-watcher.toml b/app/data/config/watcher-uniswap-v3/uni-watcher.toml similarity index 100% rename from config/watcher-uniswap-v3/uni-watcher.toml rename to app/data/config/watcher-uniswap-v3/uni-watcher.toml diff --git a/config/watcher-uniswap-v3/watch-contract.sh b/app/data/config/watcher-uniswap-v3/watch-contract.sh similarity index 100% rename from config/watcher-uniswap-v3/watch-contract.sh rename to app/data/config/watcher-uniswap-v3/watch-contract.sh diff --git a/container-build/cerc-builder-js/Dockerfile b/app/data/container-build/cerc-builder-js/Dockerfile similarity index 100% rename from container-build/cerc-builder-js/Dockerfile rename to app/data/container-build/cerc-builder-js/Dockerfile diff --git a/container-build/cerc-builder-js/README.md b/app/data/container-build/cerc-builder-js/README.md similarity index 100% rename from container-build/cerc-builder-js/README.md rename to app/data/container-build/cerc-builder-js/README.md diff --git a/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh b/app/data/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh similarity index 100% rename from container-build/cerc-builder-js/build-npm-package-local-dependencies.sh rename to app/data/container-build/cerc-builder-js/build-npm-package-local-dependencies.sh diff --git a/container-build/cerc-builder-js/build-npm-package.sh b/app/data/container-build/cerc-builder-js/build-npm-package.sh similarity index 100% rename from container-build/cerc-builder-js/build-npm-package.sh rename to app/data/container-build/cerc-builder-js/build-npm-package.sh diff --git a/container-build/cerc-builder-js/entrypoint.sh b/app/data/container-build/cerc-builder-js/entrypoint.sh similarity index 100% rename from container-build/cerc-builder-js/entrypoint.sh rename to app/data/container-build/cerc-builder-js/entrypoint.sh diff --git a/container-build/cerc-builder-js/yarn-local-registry-fixup.sh b/app/data/container-build/cerc-builder-js/yarn-local-registry-fixup.sh similarity index 100% rename from container-build/cerc-builder-js/yarn-local-registry-fixup.sh rename to app/data/container-build/cerc-builder-js/yarn-local-registry-fixup.sh diff --git a/container-build/cerc-eth-probe/build.sh b/app/data/container-build/cerc-eth-probe/build.sh similarity index 100% rename from container-build/cerc-eth-probe/build.sh rename to app/data/container-build/cerc-eth-probe/build.sh diff --git a/container-build/cerc-eth-statediff-fill-service/build.sh b/app/data/container-build/cerc-eth-statediff-fill-service/build.sh similarity index 100% rename from container-build/cerc-eth-statediff-fill-service/build.sh rename to app/data/container-build/cerc-eth-statediff-fill-service/build.sh diff --git a/container-build/cerc-eth-statediff-service/build.sh b/app/data/container-build/cerc-eth-statediff-service/build.sh similarity index 100% rename from container-build/cerc-eth-statediff-service/build.sh rename to app/data/container-build/cerc-eth-statediff-service/build.sh diff --git a/container-build/cerc-fixturenet-eth-geth/Dockerfile b/app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/Dockerfile rename to app/data/container-build/cerc-fixturenet-eth-geth/Dockerfile diff --git a/container-build/cerc-fixturenet-eth-geth/build.sh b/app/data/container-build/cerc-fixturenet-eth-geth/build.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/build.sh rename to app/data/container-build/cerc-fixturenet-eth-geth/build.sh diff --git a/container-build/cerc-fixturenet-eth-geth/genesis/Makefile b/app/data/container-build/cerc-fixturenet-eth-geth/genesis/Makefile similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/genesis/Makefile rename to app/data/container-build/cerc-fixturenet-eth-geth/genesis/Makefile diff --git a/container-build/cerc-fixturenet-eth-geth/genesis/accounts/import_keys.sh b/app/data/container-build/cerc-fixturenet-eth-geth/genesis/accounts/import_keys.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/genesis/accounts/import_keys.sh rename to app/data/container-build/cerc-fixturenet-eth-geth/genesis/accounts/import_keys.sh diff --git a/container-build/cerc-fixturenet-eth-geth/genesis/accounts/mnemonic_to_csv.py b/app/data/container-build/cerc-fixturenet-eth-geth/genesis/accounts/mnemonic_to_csv.py similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/genesis/accounts/mnemonic_to_csv.py rename to app/data/container-build/cerc-fixturenet-eth-geth/genesis/accounts/mnemonic_to_csv.py diff --git a/container-build/cerc-fixturenet-eth-geth/genesis/el/build_el.sh b/app/data/container-build/cerc-fixturenet-eth-geth/genesis/el/build_el.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/genesis/el/build_el.sh rename to app/data/container-build/cerc-fixturenet-eth-geth/genesis/el/build_el.sh diff --git a/container-build/cerc-fixturenet-eth-geth/genesis/el/el-config.yaml b/app/data/container-build/cerc-fixturenet-eth-geth/genesis/el/el-config.yaml similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/genesis/el/el-config.yaml rename to app/data/container-build/cerc-fixturenet-eth-geth/genesis/el/el-config.yaml diff --git a/container-build/cerc-fixturenet-eth-geth/run-el.sh b/app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-geth/run-el.sh rename to app/data/container-build/cerc-fixturenet-eth-geth/run-el.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile b/app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/Dockerfile rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/Dockerfile diff --git a/container-build/cerc-fixturenet-eth-lighthouse/build.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/build.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/build.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/build.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/Makefile b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/Makefile similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/Makefile rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/Makefile diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/beacon_node.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/beacon_node.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/beacon_node.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/beacon_node.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/bootnode.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/bootnode.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/bootnode.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/bootnode.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/build_cl.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/ready.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/ready.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/ready.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/ready.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/reset_genesis_time.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/reset_genesis_time.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/reset_genesis_time.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/reset_genesis_time.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/validator_client.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/validator_client.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/validator_client.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/validator_client.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env b/app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/genesis/cl/vars.env diff --git a/container-build/cerc-fixturenet-eth-lighthouse/run-cl.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/run-cl.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/run-cl.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/run-cl.sh diff --git a/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh similarity index 100% rename from container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh rename to app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh diff --git a/container-build/cerc-go-ethereum-foundry/Dockerfile b/app/data/container-build/cerc-go-ethereum-foundry/Dockerfile similarity index 100% rename from container-build/cerc-go-ethereum-foundry/Dockerfile rename to app/data/container-build/cerc-go-ethereum-foundry/Dockerfile diff --git a/container-build/cerc-go-ethereum-foundry/build.sh b/app/data/container-build/cerc-go-ethereum-foundry/build.sh similarity index 100% rename from container-build/cerc-go-ethereum-foundry/build.sh rename to app/data/container-build/cerc-go-ethereum-foundry/build.sh diff --git a/container-build/cerc-go-ethereum-foundry/deploy-local-network.sh b/app/data/container-build/cerc-go-ethereum-foundry/deploy-local-network.sh similarity index 100% rename from container-build/cerc-go-ethereum-foundry/deploy-local-network.sh rename to app/data/container-build/cerc-go-ethereum-foundry/deploy-local-network.sh diff --git a/container-build/cerc-go-ethereum-foundry/genesis-automine.json b/app/data/container-build/cerc-go-ethereum-foundry/genesis-automine.json similarity index 100% rename from container-build/cerc-go-ethereum-foundry/genesis-automine.json rename to app/data/container-build/cerc-go-ethereum-foundry/genesis-automine.json diff --git a/container-build/cerc-go-ethereum-foundry/genesis.json b/app/data/container-build/cerc-go-ethereum-foundry/genesis.json similarity index 100% rename from container-build/cerc-go-ethereum-foundry/genesis.json rename to app/data/container-build/cerc-go-ethereum-foundry/genesis.json diff --git a/container-build/cerc-go-ethereum-foundry/start-private-network.sh b/app/data/container-build/cerc-go-ethereum-foundry/start-private-network.sh similarity index 100% rename from container-build/cerc-go-ethereum-foundry/start-private-network.sh rename to app/data/container-build/cerc-go-ethereum-foundry/start-private-network.sh diff --git a/container-build/cerc-go-ethereum-foundry/stateful/foundry.toml b/app/data/container-build/cerc-go-ethereum-foundry/stateful/foundry.toml similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/foundry.toml rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/foundry.toml diff --git a/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/LICENSE b/app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/LICENSE similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/LICENSE rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/LICENSE diff --git a/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/Makefile b/app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/Makefile similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/Makefile rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/Makefile diff --git a/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/default.nix b/app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/default.nix similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/default.nix rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/default.nix diff --git a/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/demo/demo.sol b/app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/demo/demo.sol similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/demo/demo.sol rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/demo/demo.sol diff --git a/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/src/test.sol b/app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/src/test.sol similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/src/test.sol rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/lib/ds-test/src/test.sol diff --git a/container-build/cerc-go-ethereum-foundry/stateful/src/Stateful.sol b/app/data/container-build/cerc-go-ethereum-foundry/stateful/src/Stateful.sol similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/src/Stateful.sol rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/src/Stateful.sol diff --git a/container-build/cerc-go-ethereum-foundry/stateful/src/test/Stateful.t.sol b/app/data/container-build/cerc-go-ethereum-foundry/stateful/src/test/Stateful.t.sol similarity index 100% rename from container-build/cerc-go-ethereum-foundry/stateful/src/test/Stateful.t.sol rename to app/data/container-build/cerc-go-ethereum-foundry/stateful/src/test/Stateful.t.sol diff --git a/container-build/cerc-go-ethereum/build.sh b/app/data/container-build/cerc-go-ethereum/build.sh similarity index 100% rename from container-build/cerc-go-ethereum/build.sh rename to app/data/container-build/cerc-go-ethereum/build.sh diff --git a/container-build/cerc-ipld-eth-beacon-db/build.sh b/app/data/container-build/cerc-ipld-eth-beacon-db/build.sh similarity index 100% rename from container-build/cerc-ipld-eth-beacon-db/build.sh rename to app/data/container-build/cerc-ipld-eth-beacon-db/build.sh diff --git a/container-build/cerc-ipld-eth-beacon-indexer/build.sh b/app/data/container-build/cerc-ipld-eth-beacon-indexer/build.sh similarity index 100% rename from container-build/cerc-ipld-eth-beacon-indexer/build.sh rename to app/data/container-build/cerc-ipld-eth-beacon-indexer/build.sh diff --git a/container-build/cerc-ipld-eth-db/build.sh b/app/data/container-build/cerc-ipld-eth-db/build.sh similarity index 100% rename from container-build/cerc-ipld-eth-db/build.sh rename to app/data/container-build/cerc-ipld-eth-db/build.sh diff --git a/container-build/cerc-ipld-eth-server/build.sh b/app/data/container-build/cerc-ipld-eth-server/build.sh similarity index 100% rename from container-build/cerc-ipld-eth-server/build.sh rename to app/data/container-build/cerc-ipld-eth-server/build.sh diff --git a/container-build/cerc-keycloak/Dockerfile b/app/data/container-build/cerc-keycloak/Dockerfile similarity index 100% rename from container-build/cerc-keycloak/Dockerfile rename to app/data/container-build/cerc-keycloak/Dockerfile diff --git a/container-build/cerc-keycloak/build.sh b/app/data/container-build/cerc-keycloak/build.sh similarity index 100% rename from container-build/cerc-keycloak/build.sh rename to app/data/container-build/cerc-keycloak/build.sh diff --git a/container-build/cerc-laconic-registry-cli/Dockerfile b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile similarity index 100% rename from container-build/cerc-laconic-registry-cli/Dockerfile rename to app/data/container-build/cerc-laconic-registry-cli/Dockerfile diff --git a/container-build/cerc-laconic-registry-cli/build.sh b/app/data/container-build/cerc-laconic-registry-cli/build.sh similarity index 100% rename from container-build/cerc-laconic-registry-cli/build.sh rename to app/data/container-build/cerc-laconic-registry-cli/build.sh diff --git a/container-build/cerc-laconicd/build.sh b/app/data/container-build/cerc-laconicd/build.sh similarity index 100% rename from container-build/cerc-laconicd/build.sh rename to app/data/container-build/cerc-laconicd/build.sh diff --git a/container-build/cerc-lighthouse/Dockerfile b/app/data/container-build/cerc-lighthouse/Dockerfile similarity index 100% rename from container-build/cerc-lighthouse/Dockerfile rename to app/data/container-build/cerc-lighthouse/Dockerfile diff --git a/container-build/cerc-lighthouse/build.sh b/app/data/container-build/cerc-lighthouse/build.sh similarity index 100% rename from container-build/cerc-lighthouse/build.sh rename to app/data/container-build/cerc-lighthouse/build.sh diff --git a/container-build/cerc-lighthouse/start-lighthouse.sh b/app/data/container-build/cerc-lighthouse/start-lighthouse.sh similarity index 100% rename from container-build/cerc-lighthouse/start-lighthouse.sh rename to app/data/container-build/cerc-lighthouse/start-lighthouse.sh diff --git a/container-build/cerc-test-container/Dockerfile b/app/data/container-build/cerc-test-container/Dockerfile similarity index 100% rename from container-build/cerc-test-container/Dockerfile rename to app/data/container-build/cerc-test-container/Dockerfile diff --git a/container-build/cerc-test-container/build.sh b/app/data/container-build/cerc-test-container/build.sh similarity index 100% rename from container-build/cerc-test-container/build.sh rename to app/data/container-build/cerc-test-container/build.sh diff --git a/container-build/cerc-test-container/run.sh b/app/data/container-build/cerc-test-container/run.sh similarity index 100% rename from container-build/cerc-test-container/run.sh rename to app/data/container-build/cerc-test-container/run.sh diff --git a/container-build/cerc-test-contract/build.sh b/app/data/container-build/cerc-test-contract/build.sh similarity index 100% rename from container-build/cerc-test-contract/build.sh rename to app/data/container-build/cerc-test-contract/build.sh diff --git a/container-build/cerc-tx-spammer/build.sh b/app/data/container-build/cerc-tx-spammer/build.sh similarity index 100% rename from container-build/cerc-tx-spammer/build.sh rename to app/data/container-build/cerc-tx-spammer/build.sh diff --git a/container-build/cerc-uniswap-v3-info/Dockerfile b/app/data/container-build/cerc-uniswap-v3-info/Dockerfile similarity index 100% rename from container-build/cerc-uniswap-v3-info/Dockerfile rename to app/data/container-build/cerc-uniswap-v3-info/Dockerfile diff --git a/container-build/cerc-uniswap-v3-info/build.sh b/app/data/container-build/cerc-uniswap-v3-info/build.sh similarity index 100% rename from container-build/cerc-uniswap-v3-info/build.sh rename to app/data/container-build/cerc-uniswap-v3-info/build.sh diff --git a/container-build/cerc-watcher-erc20/Dockerfile b/app/data/container-build/cerc-watcher-erc20/Dockerfile similarity index 100% rename from container-build/cerc-watcher-erc20/Dockerfile rename to app/data/container-build/cerc-watcher-erc20/Dockerfile diff --git a/container-build/cerc-watcher-erc20/build.sh b/app/data/container-build/cerc-watcher-erc20/build.sh similarity index 100% rename from container-build/cerc-watcher-erc20/build.sh rename to app/data/container-build/cerc-watcher-erc20/build.sh diff --git a/container-build/cerc-watcher-erc721/Dockerfile b/app/data/container-build/cerc-watcher-erc721/Dockerfile similarity index 100% rename from container-build/cerc-watcher-erc721/Dockerfile rename to app/data/container-build/cerc-watcher-erc721/Dockerfile diff --git a/container-build/cerc-watcher-erc721/build.sh b/app/data/container-build/cerc-watcher-erc721/build.sh similarity index 100% rename from container-build/cerc-watcher-erc721/build.sh rename to app/data/container-build/cerc-watcher-erc721/build.sh diff --git a/container-build/cerc-watcher-mobymask/Dockerfile b/app/data/container-build/cerc-watcher-mobymask/Dockerfile similarity index 100% rename from container-build/cerc-watcher-mobymask/Dockerfile rename to app/data/container-build/cerc-watcher-mobymask/Dockerfile diff --git a/container-build/cerc-watcher-mobymask/build.sh b/app/data/container-build/cerc-watcher-mobymask/build.sh similarity index 100% rename from container-build/cerc-watcher-mobymask/build.sh rename to app/data/container-build/cerc-watcher-mobymask/build.sh diff --git a/container-build/cerc-watcher-uniswap-v3/Dockerfile b/app/data/container-build/cerc-watcher-uniswap-v3/Dockerfile similarity index 100% rename from container-build/cerc-watcher-uniswap-v3/Dockerfile rename to app/data/container-build/cerc-watcher-uniswap-v3/Dockerfile diff --git a/container-build/cerc-watcher-uniswap-v3/build.sh b/app/data/container-build/cerc-watcher-uniswap-v3/build.sh similarity index 100% rename from container-build/cerc-watcher-uniswap-v3/build.sh rename to app/data/container-build/cerc-watcher-uniswap-v3/build.sh diff --git a/container-build/default-build.sh b/app/data/container-build/default-build.sh similarity index 100% rename from container-build/default-build.sh rename to app/data/container-build/default-build.sh diff --git a/stacks/erc20/README.md b/app/data/stacks/erc20/README.md similarity index 100% rename from stacks/erc20/README.md rename to app/data/stacks/erc20/README.md diff --git a/stacks/erc20/stack.yml b/app/data/stacks/erc20/stack.yml similarity index 100% rename from stacks/erc20/stack.yml rename to app/data/stacks/erc20/stack.yml diff --git a/stacks/erc721/README.md b/app/data/stacks/erc721/README.md similarity index 100% rename from stacks/erc721/README.md rename to app/data/stacks/erc721/README.md diff --git a/stacks/erc721/stack.yml b/app/data/stacks/erc721/stack.yml similarity index 100% rename from stacks/erc721/stack.yml rename to app/data/stacks/erc721/stack.yml diff --git a/stacks/fixturenet-eth/README.md b/app/data/stacks/fixturenet-eth/README.md similarity index 100% rename from stacks/fixturenet-eth/README.md rename to app/data/stacks/fixturenet-eth/README.md diff --git a/stacks/fixturenet-eth/stack.yml b/app/data/stacks/fixturenet-eth/stack.yml similarity index 100% rename from stacks/fixturenet-eth/stack.yml rename to app/data/stacks/fixturenet-eth/stack.yml diff --git a/stacks/laconicd/README.md b/app/data/stacks/laconicd/README.md similarity index 100% rename from stacks/laconicd/README.md rename to app/data/stacks/laconicd/README.md diff --git a/stacks/laconicd/stack.yml b/app/data/stacks/laconicd/stack.yml similarity index 100% rename from stacks/laconicd/stack.yml rename to app/data/stacks/laconicd/stack.yml diff --git a/stacks/mobymask/README.md b/app/data/stacks/mobymask/README.md similarity index 100% rename from stacks/mobymask/README.md rename to app/data/stacks/mobymask/README.md diff --git a/stacks/mobymask/stack.yml b/app/data/stacks/mobymask/stack.yml similarity index 100% rename from stacks/mobymask/stack.yml rename to app/data/stacks/mobymask/stack.yml diff --git a/stacks/uniswap-v3/README.md b/app/data/stacks/uniswap-v3/README.md similarity index 100% rename from stacks/uniswap-v3/README.md rename to app/data/stacks/uniswap-v3/README.md diff --git a/stacks/uniswap-v3/stack.yml b/app/data/stacks/uniswap-v3/stack.yml similarity index 100% rename from stacks/uniswap-v3/stack.yml rename to app/data/stacks/uniswap-v3/stack.yml diff --git a/app/deploy_system.py b/app/deploy_system.py index 45f6b61e..7195d593 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -20,7 +20,7 @@ import os import sys from python_on_whales import DockerClient import click -import pkg_resources +import importlib from .util import include_exclude_check @@ -40,6 +40,9 @@ def command(ctx, include, exclude, cluster, command, services): verbose = ctx.obj.verbose dry_run = ctx.obj.dry_run + # See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure + compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose") + if cluster is None: # Create default unique, stable cluster name from confile file path # TODO: change this to the config file path @@ -49,8 +52,10 @@ def command(ctx, include, exclude, cluster, command, services): if verbose: print(f"Using cluster name: {cluster}") - with pkg_resources.resource_stream(__name__, "data/pod-list.txt") as pod_list_file: - pods = pod_list_file.read().decode().splitlines() + # See: https://stackoverflow.com/a/20885799/1701505 + from . import data + with importlib.resources.open_text(data, "pod-list.txt") as pod_list_file: + pods = pod_list_file.read().splitlines() if verbose: print(f"Pods: {pods}") @@ -60,7 +65,7 @@ def command(ctx, include, exclude, cluster, command, services): compose_files = [] for pod in pods: if include_exclude_check(pod, include, exclude): - compose_file_name = os.path.join("compose", f"docker-compose-{pod}.yml") + compose_file_name = os.path.join(compose_dir, f"docker-compose-{pod}.yml") compose_files.append(compose_file_name) else: if verbose: diff --git a/app/setup_repositories.py b/app/setup_repositories.py index 3086cbb1..bb1c3c69 100644 --- a/app/setup_repositories.py +++ b/app/setup_repositories.py @@ -22,7 +22,7 @@ from decouple import config import git from tqdm import tqdm import click -import pkg_resources +import importlib from .util import include_exclude_check @@ -91,8 +91,10 @@ def command(ctx, include, exclude, git_ssh, check_only, pull, branches_file): print('Dev root directory doesn\'t exist, creating') os.makedirs(dev_root_path) - with pkg_resources.resource_stream(__name__, "data/repository-list.txt") as repository_list_file: - all_repos = repository_list_file.read().decode().splitlines() + # See: https://stackoverflow.com/a/20885799/1701505 + from . import data + with importlib.resources.open_text(data, "repository-list.txt") as repository_list_file: + all_repos = repository_list_file.read().splitlines() if verbose: print(f"Repos: {all_repos}") diff --git a/setup.py b/setup.py index 17d2ae35..94a2af53 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,8 @@ setup( install_requires=[requirements], python_requires='>=3.7', include_package_data=True, - package_data={'': ['data/*.txt']}, + # See: https://github.com/pypa/setuptools/issues/1806 + package_data={'': ['data/*', 'data/*/*', 'data/*/*/*']}, classifiers=[ "Programming Language :: Python :: 3.8", "Operating System :: OS Independent",