poly-hammer-utils 0.0.24__py3-none-any.whl → 0.0.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- poly_hammer_utils/constants.py +4 -1
- poly_hammer_utils/extension/meta_human_dna.py +11 -4
- poly_hammer_utils/extension/server.py +39 -2
- {poly_hammer_utils-0.0.24.dist-info → poly_hammer_utils-0.0.25.dist-info}/METADATA +2 -1
- {poly_hammer_utils-0.0.24.dist-info → poly_hammer_utils-0.0.25.dist-info}/RECORD +6 -6
- {poly_hammer_utils-0.0.24.dist-info → poly_hammer_utils-0.0.25.dist-info}/WHEEL +0 -0
poly_hammer_utils/constants.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from pathlib import Path
|
|
2
3
|
|
|
3
4
|
RESOURCES_FOLDER = Path(__file__).parent / 'resources'
|
|
4
5
|
|
|
5
|
-
BLENDER_STARTUP_SCRIPT = RESOURCES_FOLDER / 'scripts' / 'blender' / 'startup.py'
|
|
6
|
+
BLENDER_STARTUP_SCRIPT = RESOURCES_FOLDER / 'scripts' / 'blender' / 'startup.py'
|
|
7
|
+
|
|
8
|
+
ENVIRONMENT = os.environ.get('ENVIRONMENT', 'staging')
|
|
@@ -3,11 +3,18 @@ import logging
|
|
|
3
3
|
import zipfile
|
|
4
4
|
import tempfile
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from poly_hammer_utils.constants import ENVIRONMENT
|
|
6
7
|
from poly_hammer_utils.utilities import download_and_unzip_to_folder, download_release_file
|
|
7
8
|
from poly_hammer_utils.github.release import GitHubRelease
|
|
8
9
|
from poly_hammer_utils.extension.packager import package_extension, get_addon_version
|
|
9
10
|
from poly_hammer_utils.extension.server import update_extension_index, sync_extensions_from_s3
|
|
10
11
|
|
|
12
|
+
BLENDER_EXTENSION_SERVER_S3_BUCKET = 'poly-hammer-portal-staging-app-data'
|
|
13
|
+
if ENVIRONMENT == 'production':
|
|
14
|
+
BLENDER_EXTENSION_SERVER_S3_BUCKET = 'poly-hammer-portal-production-app-data'
|
|
15
|
+
|
|
16
|
+
BLENDER_EXTENSION_SERVER_S3_FOLDER = 'products/blender-extensions/meta_human_dna'
|
|
17
|
+
|
|
11
18
|
logger = logging.getLogger(__name__)
|
|
12
19
|
|
|
13
20
|
PREFIX = 'meta_human_dna_core.'
|
|
@@ -122,8 +129,8 @@ def create_release(addon_folder: Path, releases_folder: Path):
|
|
|
122
129
|
# First, sync existing extensions from S3
|
|
123
130
|
sync_extensions_from_s3(
|
|
124
131
|
repo_folder=releases_folder,
|
|
125
|
-
bucket=
|
|
126
|
-
s3_prefix=
|
|
132
|
+
bucket=BLENDER_EXTENSION_SERVER_S3_BUCKET,
|
|
133
|
+
s3_prefix=BLENDER_EXTENSION_SERVER_S3_FOLDER,
|
|
127
134
|
)
|
|
128
135
|
|
|
129
136
|
# Create the new .zip files for the addon's various platforms
|
|
@@ -168,8 +175,8 @@ def create_release(addon_folder: Path, releases_folder: Path):
|
|
|
168
175
|
# Generate the updated extension index and upload it and the addons .zip file to S3
|
|
169
176
|
update_extension_index(
|
|
170
177
|
repo_folder=releases_folder,
|
|
171
|
-
bucket=
|
|
172
|
-
s3_folder=
|
|
178
|
+
bucket=BLENDER_EXTENSION_SERVER_S3_BUCKET,
|
|
179
|
+
s3_folder=BLENDER_EXTENSION_SERVER_S3_FOLDER,
|
|
173
180
|
blender_version=os.environ['BLENDER_VERSION'],
|
|
174
181
|
docker=True
|
|
175
182
|
)
|
|
@@ -2,7 +2,9 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
import logging
|
|
4
4
|
import boto3
|
|
5
|
+
import httpx
|
|
5
6
|
from pathlib import Path
|
|
7
|
+
from poly_hammer_utils.constants import ENVIRONMENT
|
|
6
8
|
from poly_hammer_utils.utilities import shell, get_blender_executable
|
|
7
9
|
|
|
8
10
|
logger = logging.getLogger(__name__)
|
|
@@ -11,6 +13,11 @@ ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY_ID')
|
|
|
11
13
|
SECRET_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
|
12
14
|
REGION = os.environ.get('AWS_REGION')
|
|
13
15
|
|
|
16
|
+
BASE_URL = 'https://api.portal.staging.polyhammer.com'
|
|
17
|
+
if ENVIRONMENT == 'production':
|
|
18
|
+
BASE_URL = 'https://api.portal.polyhammer.com'
|
|
19
|
+
|
|
20
|
+
PORTAL_API_KEY = os.environ.get('PORTAL_API_KEY')
|
|
14
21
|
|
|
15
22
|
def sync_extensions_from_s3(
|
|
16
23
|
repo_folder: Path,
|
|
@@ -164,6 +171,34 @@ def generate_extension_index(
|
|
|
164
171
|
|
|
165
172
|
shell(command)
|
|
166
173
|
|
|
174
|
+
def trigger_poly_hammer_portal_extension_index_refresh() -> httpx.Response:
|
|
175
|
+
"""Trigger sync of all extensions from S3."""
|
|
176
|
+
logger.info("Triggering extension sync...")
|
|
177
|
+
|
|
178
|
+
url = f"{BASE_URL}/api/v1/admin/extensions/sync"
|
|
179
|
+
headers = {"X-Admin-API-Key": PORTAL_API_KEY}
|
|
180
|
+
|
|
181
|
+
response = httpx.post(url, headers=headers, timeout=60.0)
|
|
182
|
+
|
|
183
|
+
if response.status_code == 200:
|
|
184
|
+
data = response.json()
|
|
185
|
+
logger.info("Sync complete!")
|
|
186
|
+
logger.info(f"Extensions processed: {data['extensions_processed']}")
|
|
187
|
+
logger.info(f"Platforms synced: {data['total_platforms_synced']}")
|
|
188
|
+
|
|
189
|
+
if data.get("errors"):
|
|
190
|
+
logger.error(f"Errors: {data['errors']}")
|
|
191
|
+
|
|
192
|
+
if data.get("details"):
|
|
193
|
+
logger.info("Extension details:")
|
|
194
|
+
for ext in data["details"]:
|
|
195
|
+
logger.info(f"- {ext['extension_id']}: {ext['versions_synced']} versions, {ext['platforms_synced']} platforms")
|
|
196
|
+
else:
|
|
197
|
+
logger.error(f"Failed with status {response.status_code}")
|
|
198
|
+
logger.error(f"Response: {response.text}")
|
|
199
|
+
|
|
200
|
+
return response
|
|
201
|
+
|
|
167
202
|
def update_extension_index(
|
|
168
203
|
repo_folder: Path,
|
|
169
204
|
bucket: str,
|
|
@@ -182,17 +217,19 @@ def update_extension_index(
|
|
|
182
217
|
blender_version (str, optional): Blender version to use. Defaults to '4.5'.
|
|
183
218
|
docker (bool, optional): Whether to use Docker for index generation. Defaults to False.
|
|
184
219
|
"""
|
|
185
|
-
# Step
|
|
220
|
+
# Step 1: Generate the extension index from all local .zip files
|
|
186
221
|
generate_extension_index(
|
|
187
222
|
repo_folder=repo_folder,
|
|
188
223
|
blender_version=blender_version,
|
|
189
224
|
docker=docker,
|
|
190
225
|
)
|
|
191
226
|
|
|
192
|
-
# Step
|
|
227
|
+
# Step 2: Upload new/modified .zip files and the updated index.json back to S3
|
|
193
228
|
upload_extensions_to_s3(
|
|
194
229
|
repo_folder=repo_folder,
|
|
195
230
|
bucket=bucket,
|
|
196
231
|
s3_prefix=s3_folder,
|
|
197
232
|
)
|
|
198
233
|
|
|
234
|
+
# Step 3: Trigger the Poly Hammer Portal to refresh its extension index
|
|
235
|
+
trigger_poly_hammer_portal_extension_index_refresh()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: poly-hammer-utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.25
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Poly Hammer
|
|
6
6
|
Author-email: info@polyhammer.com
|
|
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Requires-Dist: PyGithub (==2.5.0)
|
|
12
12
|
Requires-Dist: boto3 (>=1.42.35,<2.0.0)
|
|
13
|
+
Requires-Dist: httpx (>=0.28.1,<0.29.0)
|
|
13
14
|
Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
|
|
14
15
|
Requires-Dist: requirements-parser (>=0.11.0,<0.12.0)
|
|
15
16
|
Requires-Dist: tomlkit (>=0.14.0,<0.15.0)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
poly_hammer_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
poly_hammer_utils/addon/packager.py,sha256=apoZhQpd2QeRucFq53u-L1FPmN4MYuiNrjTETAE9NQg,8435
|
|
3
3
|
poly_hammer_utils/addon/release.py,sha256=EZirS8_c9S1OEZoOHStgciu_C7vMxBc_-O5P1fM9Qu4,9074
|
|
4
|
-
poly_hammer_utils/constants.py,sha256=
|
|
5
|
-
poly_hammer_utils/extension/meta_human_dna.py,sha256=
|
|
4
|
+
poly_hammer_utils/constants.py,sha256=4XGiwn7ip50V1zvmpVD9YZYmE6wPhj2Ark2AXQuJvSc,228
|
|
5
|
+
poly_hammer_utils/extension/meta_human_dna.py,sha256=HP5BGYhxwjlPBAPnJxqtKjVI5uWyK3ZTFFLDJ3jNoaw,7740
|
|
6
6
|
poly_hammer_utils/extension/packager.py,sha256=btYzyU_fa2Qaa6R9eZSojQ5uy3nQ0kDxCf49LnTZrHM,2115
|
|
7
|
-
poly_hammer_utils/extension/server.py,sha256=
|
|
7
|
+
poly_hammer_utils/extension/server.py,sha256=vuDMqEehgFiFiUy-R28oKzijHo5wIJzW0l66wwPU6I8,8072
|
|
8
8
|
poly_hammer_utils/github/release.py,sha256=P4vrNvdgWuzJI0mRye09BP6vL5b7kQ5fpuDDnEqJbwg,9951
|
|
9
9
|
poly_hammer_utils/helpers.py,sha256=f_2fNrydsbIvwD2LuoBj2gjETMP7dFzJtq1_7WMBwNI,1655
|
|
10
10
|
poly_hammer_utils/launch.py,sha256=Nc9FlFuGtMSjgSLsk6MMMj-FECsOGtfUQlZaUZt_rGU,469
|
|
11
11
|
poly_hammer_utils/resources/scripts/blender/startup.py,sha256=eUd0VwAHjTwIscVKCbk_0-F7p0jgIEsVYdzpIjlzOK0,2282
|
|
12
12
|
poly_hammer_utils/resources/scripts/unreal/init_unreal.py,sha256=1-d9IU8ZSAIS3MUANrsGx4ZmqNJ5f8S2k8XJVg0Bghs,693
|
|
13
13
|
poly_hammer_utils/utilities.py,sha256=7dmZo02HXbWhfmwDHkgVUE_gyq4e-gqb4OdBc2bokbs,6491
|
|
14
|
-
poly_hammer_utils-0.0.
|
|
15
|
-
poly_hammer_utils-0.0.
|
|
16
|
-
poly_hammer_utils-0.0.
|
|
14
|
+
poly_hammer_utils-0.0.25.dist-info/METADATA,sha256=4qTBctRnioUIPFOWKdlMakIu8peOj5qzyrzs1FQoJo4,934
|
|
15
|
+
poly_hammer_utils-0.0.25.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
16
|
+
poly_hammer_utils-0.0.25.dist-info/RECORD,,
|
|
File without changes
|