Skip to content

Commit

Permalink
Allow better name metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Jul 6, 2019
1 parent e2b38d2 commit f1bfee0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pipenv/vendor/pythonfinder/models/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def __getattribute__(self, key):

@property
def version_sort(self):
# type: () -> Tuple[Optional[int], Optional[int], int, int]
# type: () -> Tuple[int, int, Optional[int], int, int]
"""
A tuple for sorting against other instances of the same class.
Expand Down Expand Up @@ -620,11 +620,13 @@ def parse_executable(cls, path):
return result_dict

@classmethod
def from_windows_launcher(cls, launcher_entry, name=None):
# type: (Environment, Optional[str]) -> PythonVersion
def from_windows_launcher(cls, launcher_entry, name=None, company=None):
# type: (Environment, Optional[str], Optional[str]) -> PythonVersion
"""Create a new PythonVersion instance from a Windows Launcher Entry
:param launcher_entry: A python launcher environment object.
:param Optional[str] name: The name of the distribution.
:param Optional[str] company: The name of the distributing company.
:return: An instance of a PythonVersion.
:rtype: :class:`~pythonfinder.models.python.PythonVersion`
"""
Expand All @@ -639,7 +641,7 @@ def from_windows_launcher(cls, launcher_entry, name=None):
exe_path = ensure_path(
getattr(launcher_entry.info.install_path, "executable_path", default_path)
)
company = getattr(launcher_entry, "company", "PythonCore")
company = getattr(launcher_entry, "company", guess_company(exe_path.as_posix()))
creation_dict.update(
{
"architecture": getattr(
Expand Down
3 changes: 2 additions & 1 deletion pipenv/vendor/pythonfinder/models/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def get_versions(self):
for version_object in env_versions:
install_path = getattr(version_object.info, "install_path", None)
name = getattr(version_object, "tag", None)
company = getattr(version_object, "company", None)
if install_path is None:
continue
try:
Expand All @@ -90,7 +91,7 @@ def get_versions(self):
continue
try:
py_version = PythonVersion.from_windows_launcher(
version_object, name=name
version_object, name=name, company=company
)
except InvalidPythonVersion:
continue
Expand Down

0 comments on commit f1bfee0

Please sign in to comment.