Skip to content

Commit

Permalink
0.7.1 beta
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
Ivan Titov committed Apr 30, 2020
1 parent e2cca57 commit 9162721
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.setup
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Package Manager",
"author": "Ivan Titov",
"version": "0.7.0-beta",
"version": "0.7.1-beta",
"version_type": "version",
"source": "Houdini-Packages/Houdini-Package-Manager",
"source_type": "github"
Expand Down
22 changes: 13 additions & 9 deletions python2.7libs/package_manager/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ def extractRepoZip(file_path, repo_data, dst_location='$HOUDINI_USER_PREF_DIR',
if not dst_name:
_, extension = os.path.splitext(os.path.basename(file_path))
dst_name = repo_data.get('full_name', extension)
dst_name = dst_name.replace('/', '_')
dst_location = os.path.join(hou.expandString(dst_location), dst_name)
dst_name = dst_name.replace('/', '__')
dst_location = os.path.join(hou.expandString(dst_location),
hou.expandString(dst_name))
if os.path.exists(dst_location):
shutil.rmtree(dst_location)
with zipfile.ZipFile(file_path) as file:
Expand Down Expand Up @@ -181,28 +182,29 @@ def updatePackageDataFile(repo_data, package, package_location,
data = {}
package = package or WebPackage()
if not data.get('name') or update:
data['name'] = package.name or repo_data['name']
data['name'] = package.name or repo_data['name'] or data.get('name')
if not data.get('description') or update:
data['description'] = package.description or repo_data['description']
data['description'] = package.description or repo_data['description'] or data.get('description')
if not data.get('author') or update:
data['author'] = package.author or repo_data['owner']['login']
data['author'] = package.author or repo_data['owner']['login'] or data.get('author')
if not data.get('source') or update:
data['source'] = package.source or repo_data['full_name']
data['source'] = package.source or repo_data['full_name'] or data.get('source')
if not data.get('source_type'):
data['source_type'] = package.source_type or 'github'
# Todo: or Version(data['version']) < version # consider type
if update or not data.get('version') or not data.get('version_type'):
data['version'] = version
data['version_type'] = version_type
if not data.get('hversion') or update:
data['hversion'] = package.hversion or '*'
data['hversion'] = package.hversion or data.get('hversion') or '*'
if not data.get('hlicense'):
data['hlicense'] = package.hlicense or \
data.get('hlicense') or \
fullHoudiniLicenseName(HOUDINI_COMMERCIAL_LICENSE)
if not data.get('status') or update:
data['status'] = package.status or 'Stable'
data['status'] = package.status or data.get('status') or 'Stable'
if not data.get('setup_schema') or update:
data['setup_schema'] = package.setup_schema
data['setup_schema'] = package.setup_schema or data.get('setup_schema')
with open(data_file_path, 'w') as file:
json.dump(data, file, indent=4, encoding='utf-8')

Expand Down Expand Up @@ -257,9 +259,11 @@ def installFromRepo(package_or_link, dst_location='$HOUDINI_USER_PREF_DIR', upda
else:
package_location = extractRepoZip(zip_file, repo_data, dst_location)
os.remove(zip_file)

if len(versions) == 0:
version = repo_data['pushed_at']
updatePackageDataFile(repo_data, package, package_location, version, version_type, update)

if not update:
LocalPackage.install(package_location, setup_schema=package.setup_schema or setup_schema)
return True
Expand Down
3 changes: 2 additions & 1 deletion python2.7libs/package_manager/local_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ def __init__(self, package_file):
with open(package_file) as file:
data = json.load(file)

self.content_path = os.path.normpath(data['path']).replace('\\', '/')
self.content_path = os.path.normpath(hou.expandString(data['path'])).replace('\\', '/')
if not os.path.isdir(self.content_path):
raise IOError(self.content_path)

if not isPackageFolder(self.content_path):
raise NotPackageError('Folder "{0}" is not a package'.format(self.content_path))

Expand Down

0 comments on commit 9162721

Please sign in to comment.