Unpacking BAM wheel into versionless directory.
This makes it easier to see what changed when we update to a newer version of BAM.
This commit is contained in:
parent
6e38b99641
commit
4cf22894e2
|
@ -20,7 +20,7 @@ by running:
|
|||
|
||||
python3 install_whl.py /path/to/blender-asset-manager/dist/blender_bam-xxx.whl
|
||||
|
||||
This script also updates `__init__.py` to update the version number and path of the extracted
|
||||
This script also updates `__init__.py` to update the version number of the extracted
|
||||
wheel, and removes any pre-existing older versions of the BAM wheels.
|
||||
|
||||
The version number and `.whl` extension are maintained in the directory name on purpose.
|
||||
|
|
|
@ -29,7 +29,7 @@ bl_info = {
|
|||
"category": "Import-Export",
|
||||
}
|
||||
|
||||
BAM_WHEEL_PATH = 'blender_bam-1.1.7-py3-none-any.whl'
|
||||
BAM_WHEEL_PATH = 'blender_bam-unpacked.whl'
|
||||
|
||||
import logging
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ def install(wheelfile: pathlib.Path):
|
|||
wipe_preexisting()
|
||||
|
||||
print('Installing %s' % wheelfile)
|
||||
target = my_dir / wheelfile.name
|
||||
target = my_dir / 'blender_bam-unpacked.whl'
|
||||
print('Creating target directory %s' % target)
|
||||
target.mkdir(parents=True)
|
||||
|
||||
|
@ -36,7 +36,7 @@ def install(wheelfile: pathlib.Path):
|
|||
|
||||
version = find_version(target)
|
||||
print('This is BAM version %s' % (version, ))
|
||||
update_init_file(wheelfile, version)
|
||||
update_init_file(version)
|
||||
|
||||
print('Done installing %s' % wheelfile.name)
|
||||
|
||||
|
@ -102,13 +102,11 @@ def find_version(target: pathlib.Path):
|
|||
return tuple(int(x) for x in str_ver.split('.'))
|
||||
|
||||
|
||||
def update_init_file(wheelfile: pathlib.Path, version: tuple):
|
||||
def update_init_file(version: tuple):
|
||||
import os
|
||||
import re
|
||||
|
||||
print('Updating __init__.py to point to this wheel.')
|
||||
|
||||
path_line_re = re.compile(r'^BAM_WHEEL_PATH\s*=')
|
||||
print('Updating __init__.py to have the correct version.')
|
||||
version_line_re = re.compile(r'^\s+[\'"]version[\'"]: (\([0-9,]+\)),')
|
||||
|
||||
with open('__init__.py', 'r') as infile, \
|
||||
|
@ -117,8 +115,6 @@ def update_init_file(wheelfile: pathlib.Path, version: tuple):
|
|||
for line in infile:
|
||||
if version_line_re.match(line):
|
||||
outfile.write(" 'version': %s,%s" % (version, os.linesep))
|
||||
if path_line_re.match(line):
|
||||
outfile.write("BAM_WHEEL_PATH = '%s'%s" % (wheelfile.name, os.linesep))
|
||||
else:
|
||||
outfile.write(line)
|
||||
|
||||
|
|
Loading…
Reference in New Issue