-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #252
- Loading branch information
Showing
1 changed file
with
17 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,44 @@ | ||
import platform | ||
from importlib.metadata import version, distribution | ||
|
||
from pkg_resources import get_distribution | ||
|
||
from sunpy.extern.distro import linux_distribution | ||
from sunpy.util.sysinfo import find_dependencies | ||
import sunpy.extern.distro as distro | ||
from sunpy.util.sysinfo import find_dependencies, get_keys_list, get_requirements | ||
|
||
__all__ = ['system_info'] | ||
|
||
|
||
def system_info(): | ||
""" | ||
Display information about your system for submitting bug reports. | ||
Prints ones' system info in an "attractive" fashion. | ||
""" | ||
base_reqs = get_distribution("dkist").requires() | ||
base_reqs = {base_req.name.lower() for base_req in base_reqs} | ||
|
||
missing_packages, installed_packages = find_dependencies(package="dkist") | ||
package_name = "dkist" | ||
requirements = get_requirements(package_name) | ||
base_reqs = get_keys_list(requirements['required']) | ||
missing_packages, installed_packages = find_dependencies(package=package_name) | ||
extra_prop = {"System": platform.system(), | ||
"Arch": f"{platform.architecture()[0]}, ({platform.processor()})", | ||
"Python": platform.python_version(), | ||
"SunPy": get_distribution("dkist").version} | ||
package_name: version(package_name)} | ||
sys_prop = {**installed_packages, **missing_packages, **extra_prop} | ||
|
||
print("==============================") | ||
print("DKIST Installation Information") | ||
print("dkist Installation Information") | ||
print("==============================") | ||
print() | ||
print("General") | ||
print("#######") | ||
if sys_prop['System'] == "Linux": | ||
distro = " ".join(linux_distribution()) | ||
print(f"OS: {distro} (Linux {platform.release()})") | ||
print(f"OS: {distro.name()} ({distro.version()}, Linux {platform.release()})") | ||
elif sys_prop['System'] == "Darwin": | ||
print(f"OS: Mac OS {platform.mac_ver()[0]}") | ||
elif sys_prop['System'] == "Windows": | ||
print(f"OS: Windows {platform.release()} {platform.version()}") | ||
else: | ||
print("Unknown OS") | ||
for sys_info in ['Arch', 'SunPy']: | ||
print('{} : {}'.format(sys_info, sys_prop[sys_info])) | ||
for sys_info in ['Arch', package_name]: | ||
print(f'{sys_info}: {sys_prop[sys_info]}') | ||
print(f'Installation path: {distribution("sunpy")._path}') | ||
print() | ||
print("Required Dependices") | ||
print("###################") | ||
print("Required Dependencies") | ||
print("#####################") | ||
for req in base_reqs: | ||
print('{}: {}'.format(req, sys_prop[req])) | ||
print(f'{req}: {sys_prop[req]}') |