This repository was archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Update clr helper function to search multiple folders for clr binaries. #72
Merged
montebhoover
merged 4 commits into
microsoft:master
from
montebhoover:fix_dotnetcore_import
Dec 15, 2018
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0c1b3cf
Update clr helper function to search multiple folders for clr binaries.
montebhoover 2098edd
Moved responsiblity for Python version checking to utility functions.
montebhoover 4363c64
Add clarifying comments.
montebhoover 2833360
Fix call to get_nimbusml_libs()
montebhoover 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 hidden or 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 |
|---|---|---|
|
|
@@ -300,21 +300,20 @@ def get_clr_path(): | |
| Python 3.x only, as dotnetcore2 is not available for Python 2.x. | ||
| """ | ||
| from dotnetcore2 import runtime as clr_runtime | ||
| clr_version = pkg_resources.get_distribution('dotnetcore2').version | ||
| partial_path = os.path.join(clr_runtime._get_bin_folder(), 'shared', 'Microsoft.NETCore.App') | ||
| clr_path = os.path.join(partial_path, clr_version) | ||
| if not os.path.exists(clr_path): | ||
| # If folder name does not match published version, use the folder that | ||
| # exists | ||
| try: | ||
| version_folder = os.listdir(partial_path)[0] | ||
| except IndexError: | ||
| raise ImportError("Trouble importing dotnetcore2: " | ||
| "{} had no version folder.".format(partial_path)) | ||
| clr_path = os.path.join(partial_path, version_folder) | ||
| # Verify binaries are present | ||
| if not os.path.exists(os.path.join(clr_path, 'Microsoft.CSharp.dll')): | ||
| raise ImportError( | ||
| "Trouble importing dotnetcore2: Microsoft.CSharp.dll was not " | ||
| "found in {}.".format(clr_path)) | ||
| bin_root = os.path.join(clr_runtime._get_bin_folder(), 'shared', 'Microsoft.NETCore.App') | ||
|
|
||
| # Search all bin folders to find which one contains the .NET CLR binaries | ||
| bin_folders = os.listdir(bin_root) | ||
| if len(bin_folders) == 0: | ||
| raise ImportError("Trouble importing dotnetcore2: " | ||
| "{} had no bin folders.".format(bin_root)) | ||
|
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.
perhaps be specific that bin/shared/ms.netore.app is missing in the message? |
||
| clr_path = None | ||
| for folder in bin_folders: | ||
| if os.path.exists(os.path.join(bin_root, folder, 'Microsoft.CSharp.dll')): | ||
| clr_path = os.path.join(bin_root, folder) | ||
| break | ||
| if not clr_path: | ||
| raise ImportError( | ||
| "Trouble importing dotnetcore2: Microsoft.CSharp.dll was not " | ||
| "found in {}.".format(bin_root)) | ||
| return clr_path | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
do we check the python version here? How do we ensure that we fail of Python 2.7? #Closed