poly-hammer-utils 0.0.27__py3-none-any.whl → 0.0.28__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/extension/meta_human_dna.py +39 -7
- {poly_hammer_utils-0.0.27.dist-info → poly_hammer_utils-0.0.28.dist-info}/METADATA +1 -1
- {poly_hammer_utils-0.0.27.dist-info → poly_hammer_utils-0.0.28.dist-info}/RECORD +4 -4
- {poly_hammer_utils-0.0.27.dist-info → poly_hammer_utils-0.0.28.dist-info}/WHEEL +0 -0
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import logging
|
|
3
3
|
import zipfile
|
|
4
4
|
import tempfile
|
|
5
|
+
import shutil
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from poly_hammer_utils.constants import ENVIRONMENT
|
|
7
8
|
from poly_hammer_utils.utilities import download_and_unzip_to_folder, download_release_file
|
|
@@ -121,18 +122,24 @@ def get_meta_human_dna_core(addon_version: str, auth_token: str) -> list[Path]:
|
|
|
121
122
|
file_paths.append(save_path)
|
|
122
123
|
return file_paths
|
|
123
124
|
|
|
124
|
-
def create_release(addon_folder: Path, releases_folder: Path):
|
|
125
|
+
def create_release(addon_folder: Path, releases_folder: Path, pro: bool = False):
|
|
125
126
|
token = os.environ['GH_PAT']
|
|
126
127
|
|
|
127
128
|
addon_version = get_addon_version(source_folder=addon_folder)
|
|
128
129
|
|
|
130
|
+
s3_prefix = BLENDER_EXTENSION_SERVER_S3_FOLDER
|
|
131
|
+
if pro:
|
|
132
|
+
s3_prefix = f'{s3_prefix}_pro'
|
|
133
|
+
releases_folder = releases_folder / 'pro'
|
|
134
|
+
|
|
129
135
|
# First, sync existing extensions from S3
|
|
130
136
|
sync_extensions_from_s3(
|
|
131
137
|
repo_folder=releases_folder,
|
|
132
138
|
bucket=BLENDER_EXTENSION_SERVER_S3_BUCKET,
|
|
133
|
-
s3_prefix=
|
|
139
|
+
s3_prefix=s3_prefix,
|
|
134
140
|
)
|
|
135
141
|
|
|
142
|
+
|
|
136
143
|
# Create the new .zip files for the addon's various platforms
|
|
137
144
|
addon_zip_files = package_extension(
|
|
138
145
|
source_folder=addon_folder,
|
|
@@ -155,6 +162,28 @@ def create_release(addon_folder: Path, releases_folder: Path):
|
|
|
155
162
|
for addon_zip_file in addon_zip_files:
|
|
156
163
|
platform, arch = parse_blender_extension_zip_info(url=addon_zip_file)
|
|
157
164
|
files_to_zip = rig_logic_files + core_files
|
|
165
|
+
|
|
166
|
+
# If pro version, remove the resources/dna folder from the zip before adding bindings
|
|
167
|
+
if not pro:
|
|
168
|
+
files_removed = []
|
|
169
|
+
dna_folder_prefix = 'resources/dna/'
|
|
170
|
+
temp_zip_path = Path(str(addon_zip_file) + '.tmp')
|
|
171
|
+
with zipfile.ZipFile(addon_zip_file, 'r') as zip_read:
|
|
172
|
+
with zipfile.ZipFile(temp_zip_path, 'w', compression=zipfile.ZIP_DEFLATED) as zip_write:
|
|
173
|
+
for item in zip_read.infolist():
|
|
174
|
+
if not item.filename.startswith(dna_folder_prefix):
|
|
175
|
+
zip_write.writestr(item, zip_read.read(item.filename))
|
|
176
|
+
else:
|
|
177
|
+
logger.info(f"Removed {item.filename} from pro version")
|
|
178
|
+
files_removed.append(item.filename)
|
|
179
|
+
|
|
180
|
+
# Only replace the original zip if we removed files
|
|
181
|
+
if files_removed:
|
|
182
|
+
temp_zip_path.replace(addon_zip_file)
|
|
183
|
+
else:
|
|
184
|
+
temp_zip_path.unlink()
|
|
185
|
+
|
|
186
|
+
# Now add the bindings to the addon .zip
|
|
158
187
|
with zipfile.ZipFile(addon_zip_file, mode="a", compression=zipfile.ZIP_DEFLATED) as zip_file_handle:
|
|
159
188
|
for file_path in files_to_zip:
|
|
160
189
|
if file_path in rig_logic_files:
|
|
@@ -176,7 +205,7 @@ def create_release(addon_folder: Path, releases_folder: Path):
|
|
|
176
205
|
update_extension_index(
|
|
177
206
|
repo_folder=releases_folder,
|
|
178
207
|
bucket=BLENDER_EXTENSION_SERVER_S3_BUCKET,
|
|
179
|
-
s3_folder=
|
|
208
|
+
s3_folder=s3_prefix,
|
|
180
209
|
blender_version=os.environ['BLENDER_VERSION'],
|
|
181
210
|
docker=True
|
|
182
211
|
)
|
|
@@ -192,13 +221,16 @@ if __name__ == '__main__':
|
|
|
192
221
|
|
|
193
222
|
for addon_name in os.listdir(addons_folder):
|
|
194
223
|
addon_folder = addons_folder / addon_name
|
|
224
|
+
# Create both the pro and free releases
|
|
225
|
+
create_release(
|
|
226
|
+
addon_folder=addon_folder,
|
|
227
|
+
releases_folder=releases_folder,
|
|
228
|
+
pro=True
|
|
229
|
+
)
|
|
195
230
|
create_release(
|
|
196
231
|
addon_folder=addon_folder,
|
|
197
232
|
releases_folder=releases_folder
|
|
198
233
|
)
|
|
199
234
|
|
|
200
235
|
# Clean up the releases folder
|
|
201
|
-
|
|
202
|
-
if item.is_file():
|
|
203
|
-
item.unlink()
|
|
204
|
-
releases_folder.rmdir()
|
|
236
|
+
shutil.rmtree(releases_folder, ignore_errors=True)
|
|
@@ -2,7 +2,7 @@ poly_hammer_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
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
4
|
poly_hammer_utils/constants.py,sha256=4XGiwn7ip50V1zvmpVD9YZYmE6wPhj2Ark2AXQuJvSc,228
|
|
5
|
-
poly_hammer_utils/extension/meta_human_dna.py,sha256=
|
|
5
|
+
poly_hammer_utils/extension/meta_human_dna.py,sha256=fX2QoDTOVReFDusm2LYA0cDIepW3bRPgZyJpPogk4R4,9238
|
|
6
6
|
poly_hammer_utils/extension/packager.py,sha256=LyThqLWgvlQOrcn9OSChrV675iiwHTvcMCeXwAab_vM,2365
|
|
7
7
|
poly_hammer_utils/extension/server.py,sha256=vuDMqEehgFiFiUy-R28oKzijHo5wIJzW0l66wwPU6I8,8072
|
|
8
8
|
poly_hammer_utils/github/release.py,sha256=P4vrNvdgWuzJI0mRye09BP6vL5b7kQ5fpuDDnEqJbwg,9951
|
|
@@ -11,6 +11,6 @@ poly_hammer_utils/launch.py,sha256=Nc9FlFuGtMSjgSLsk6MMMj-FECsOGtfUQlZaUZt_rGU,4
|
|
|
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.28.dist-info/METADATA,sha256=3fc4GpufAb8P2I45sdbhWFl4htIcMCbGshAEf28w91A,934
|
|
15
|
+
poly_hammer_utils-0.0.28.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
16
|
+
poly_hammer_utils-0.0.28.dist-info/RECORD,,
|
|
File without changes
|