This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Bug fixes #30
Merged
Merged
Bug fixes #30
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
|
||
INSTALL_DIR = os.path.normpath( | ||
os.path.join(cmds.internalVar(userScriptDir=True), 'azure-batch-libs')) | ||
sys.path.append(INSTALL_DIR) | ||
sys.path.insert(0, INSTALL_DIR) | ||
|
||
REQUIREMENTS = { | ||
"pathlib==1.0.1": "pathlib", | ||
|
@@ -47,7 +47,7 @@ | |
"azure-batch-extensions==1.0.1": "azure.batch_extensions" | ||
} | ||
|
||
VERSION = "0.16.0" | ||
VERSION = "0.17.0" | ||
EULA_PREF = "AzureBatch_EULA" | ||
SHELF_FILE = "shelf_AzureBatch.mel" | ||
cmd_name = "AzureBatch" | ||
|
@@ -269,6 +269,7 @@ def set_environment(plugin_path): | |
sys.path.append(modpath) | ||
sys.path.append(srcpath) | ||
sys.path.append(os.path.join(srcpath, "ui")) | ||
sys.path.append(tolpath) | ||
|
||
script_dirs = os.environ["MAYA_SCRIPT_PATH"] + os.pathsep | ||
os.environ["AZUREBATCH_ICONS"] = AzureBatchSetup.clean(icnpath) | ||
|
@@ -349,7 +350,7 @@ def dependency_installed(package, namespace): | |
return True | ||
|
||
|
||
def install_pkg(package): | ||
def install_pkg(pip, package): | ||
"""Install the specified package by shelling out to pip. | ||
:param str package: A pip-formatted package reference. | ||
|
||
|
@@ -358,9 +359,7 @@ def install_pkg(package): | |
""" | ||
if not os.path.isdir(INSTALL_DIR): | ||
os.makedirs(INSTALL_DIR) | ||
pip_cmds = ['mayapy', os.path.join(INSTALL_DIR, 'pip'), | ||
'install', package, | ||
'--target', INSTALL_DIR] | ||
pip_cmds = ['mayapy', pip, 'install', package, '--target', INSTALL_DIR] | ||
print(pip_cmds) | ||
installer = subprocess.Popen(pip_cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
installer.wait() | ||
|
@@ -370,7 +369,7 @@ def install_pkg(package): | |
raise RuntimeError("Failed to install package: {}".format(package)) | ||
|
||
|
||
def install_namespace_pkg(package, namespace): | ||
def install_namespace_pkg(pip, package, namespace): | ||
"""Azure packages have issues installing one by one as they don't | ||
unpackage correctly into the namespace directory. So we have to install | ||
to a temp directory and move it to the right place. | ||
|
@@ -381,10 +380,7 @@ def install_namespace_pkg(package, namespace): | |
temp_target = os.path.join(INSTALL_DIR, 'temp-target') | ||
if not os.path.isdir(temp_target): | ||
os.makedirs(temp_target) | ||
pip_cmds = ['mayapy', os.path.join(INSTALL_DIR, 'pip'), | ||
'install', package, | ||
'--no-deps', | ||
'--target', temp_target] | ||
pip_cmds = ['mayapy', pip, 'install', package, '--no-deps', '--target', temp_target] | ||
print(pip_cmds) | ||
installer = subprocess.Popen(pip_cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
installer.wait() | ||
|
@@ -447,25 +443,39 @@ def initializePlugin(obj): | |
|
||
print("Attempting to install dependencies via Pip.") | ||
try: | ||
install_script = os.path.normpath(os.path.join( os.environ['AZUREBATCH_TOOLS'], 'install_pip.py')) | ||
installer = subprocess.Popen(["mayapy", install_script, '--target', INSTALL_DIR], | ||
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
installer.wait() | ||
if installer.returncode != 0: | ||
import pip | ||
if StrictVersion(pip.__version__) < StrictVersion("9.0.0"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we pull the version string out into a variable somewhere so its more obvious where to update it, rather than just embedding it inline |
||
print("Found out-of-date pip ({}) - attempting to upgrade.".format(pip.__version__)) | ||
raise ImportError | ||
print("Found pip installed, version: {}".format(pip.__version__)) | ||
pip_location = os.path.dirname(pip.__file__) | ||
except ImportError: | ||
try: | ||
import getpip | ||
print("Running getpip command") | ||
install_script = getpip.__file__ | ||
args = ["mayapy", install_script, "--target", INSTALL_DIR] | ||
print(args) | ||
installer = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
installer.wait() | ||
print(installer.stdout.read()) | ||
print(installer.stderr.read()) | ||
raise RuntimeError("Failed to install pip") | ||
except BaseException as exp: | ||
print("Failed to install Pip. Please install dependencies manually to continue.") | ||
raise | ||
if installer.returncode != 0: | ||
raise RuntimeError("Failed to install pip") | ||
except ImportError as e: | ||
print("Unable to load getpip") | ||
raise | ||
else: | ||
print("Getpip complete") | ||
pip_location = os.path.join(INSTALL_DIR, "pip") | ||
try: | ||
print("Installing dependencies") | ||
print("Installing dependencies using {}".format(pip_location)) | ||
for package in missing_libs: | ||
if package in NAMESPACE_PACKAGES: | ||
package_path = NAMESPACE_PACKAGES[package].split('.') | ||
install_namespace_pkg(package, os.path.join(*package_path)) | ||
install_namespace_pkg(pip_location, package, os.path.join(*package_path)) | ||
else: | ||
install_pkg(package) | ||
install_pkg(pip_location, package) | ||
shutil.copy(os.path.join(INSTALL_DIR, 'azure', '__init__.py'), os.path.join(INSTALL_DIR, 'azure', 'mgmt', '__init__.py')) | ||
except: | ||
error = "Failed to install dependencies - please install manually" | ||
|
@@ -521,6 +531,7 @@ def uninitializePlugin(obj): | |
try: | ||
sys.path.extend(os.environ["AZUREBATCH_SCRIPTS"].split(os.pathsep)) | ||
sys.path.append(os.environ['AZUREBATCH_MODULES']) | ||
sys.path.append(os.environ['AZUREBATCH_TOOLS']) | ||
except KeyError as e: | ||
print("Couldn't find Azure Batch environment, setting up now...") | ||
setup_module() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor but good practise not to increment the version number except in the process of doing a release. Good to keep in a separate commit too