Files
alttpr-python/source/classes/diags.py
codemann8 b55c3700c0 Owr actions update (#19)
* Go for Broke

* Let it fire

* Add PipLine

* Create the dir if it doesn't exist

* Install Setuptools

* Track Test Action's files

* Fix Calling Job

* Track Build Action files

* Install Distutils, rename filenames

* Fix Fail conditions

* Make Build scripts smarter

* Add file

* Concat DLLs lists

* Try to fail if Error DLLs

* Try to make the fail smarter

* Moar verbosity

* Print the stuff first

* Print outputs objects

* See if this skips failure

* Use py instead

* Print error list

* Don't ValueError

* Try checking a different way

* Try something else

* Bleh, spell filename correctly

* Update excluded_dlls.json

* Ugh, gotta compare old to new somehow

* Compare to old list

* Condense build script

* Moar verbosity

* Update the global version

* Update Excluded DLLs list

* Actually use the bad DLLs list

* Make a version number

* Fix version number building

* Fix version number building again

* Fix Diagnostics

* Try REST API stuff

* Try REST API again

* Moar REST

* await

* Get SHA

* Try it all together

* Del test workflow

* Add Perms

* Use a Token

* Try this Token

* Try different Token

* Try different Token

* Create App Version earlier

* See this error again

* Don't fail if App Version not made yet

* Use New Secret

* Print whole response

* Documentation for Tagger

* Update CI Instructions

* Update CI

* List References

* Find latest tag

Fix App Version getter

* Fix commas

* Check returned data

* Update Build Script

* Fix substring

* Fix Git tag

* Fix tag again

* Visual indicators

* Use encoding

* Remove an indicator

* Update CI

* Update Project Name

* PyInstaller Spec Template file

* Update Build Script

* Fix Tagger

* Update CI

* Download AppVersion during build

* Test job can fail

* Upload Logs instead of printing them

* Change from Reusable Workflow to Action

* Change ref to token

* Compare to string

* Use PAT

* Use String literal

* Remove Reusable Workflow

* Update CI Scripts

* Go for Broke

* Let it fire

* Add PipLine

* Create the dir if it doesn't exist

* Install Setuptools

* Track Test Action's files

* Fix Calling Job

* Track Build Action files

* Install Distutils, rename filenames

* Fix Fail conditions

* Make Build scripts smarter

* Add file

* Concat DLLs lists

* Try to fail if Error DLLs

* Try to make the fail smarter

* Moar verbosity

* Print the stuff first

* Print outputs objects

* See if this skips failure

* Use py instead

* Print error list

* Don't ValueError

* Try checking a different way

* Try something else

* Bleh, spell filename correctly

* Update excluded_dlls.json

* Ugh, gotta compare old to new somehow

* Compare to old list

* Condense build script

* Moar verbosity

* Update the global version

* Update Excluded DLLs list

* Actually use the bad DLLs list

* Make a version number

* Fix version number building

* Fix version number building again

* Fix Diagnostics

* Try REST API stuff

* Try REST API again

* Moar REST

* await

* Get SHA

* Try it all together

* Del test workflow

* Add Perms

* Use a Token

* Try this Token

* Try different Token

* Try different Token

* Create App Version earlier

* See this error again

* Don't fail if App Version not made yet

* Use New Secret

* Print whole response

* Documentation for Tagger

* Update CI Instructions

* Update CI

* List References

* Find latest tag

Fix App Version getter

* Fix commas

* Check returned data

* Update Build Script

* Fix substring

* Fix Git tag

* Fix tag again

* Visual indicators

* Use encoding

* Remove an indicator

* Update CI

* Update Project Name

* PyInstaller Spec Template file

* Update Build Script

* Fix Tagger

* Update CI

* Download AppVersion during build

* Test job can fail

* Upload Logs instead of printing them

* Change from Reusable Workflow to Action

* Change ref to token

* Compare to string

* Use PAT

* Use String literal

* Remove Reusable Workflow

* Update CI Scripts

---------

Co-authored-by: Minnie A. Trethewey (Mike) <minnietrethewey@gmail.com>
2024-05-23 19:29:39 -05:00

61 lines
2.0 KiB
Python

import platform, sys, os, subprocess
try:
import pkg_resources
except ModuleNotFoundError as e:
pass
import datetime
from Main import __version__
DR_VERSION = __version__
from OverworldShuffle import __version__
OWR_VERSION = __version__
PROJECT_NAME = "ALttP Overworld Randomizer"
def diagpad(str):
return str.ljust(len(f"{PROJECT_NAME} Version") + 5,'.')
def output():
lines = [
f"{PROJECT_NAME} Diagnostics",
"=================================",
diagpad("UTC Time") + str(datetime.datetime.now(datetime.UTC))[:19],
diagpad("ALttP Door Randomizer Version") + DR_VERSION,
diagpad(f"{PROJECT_NAME} Version") + OWR_VERSION,
diagpad("Python Version") + platform.python_version()
]
lines.append(diagpad("OS Version") + "%s %s" % (platform.system(), platform.release()))
if hasattr(sys, "executable"):
lines.append(diagpad("Executable") + sys.executable)
lines.append(diagpad("Build Date") + platform.python_build()[1])
lines.append(diagpad("Compiler") + platform.python_compiler())
if hasattr(sys, "api_version"):
lines.append(diagpad("Python API") + str(sys.api_version))
if hasattr(os, "sep"):
lines.append(diagpad("Filepath Separator") + os.sep)
if hasattr(os, "pathsep"):
lines.append(diagpad("Path Env Separator") + os.pathsep)
lines.append("")
lines.append("Packages")
lines.append("--------")
'''
#this breaks when run from the .exe
reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
installed_packages = [r.decode() for r in reqs.split()]
for pkg in installed_packages:
pkg = pkg.split("==")
lines.append(diagpad(pkg[0]) + pkg[1])
'''
installed_packages = []
installed_packages = [str(d) for d in pkg_resources.working_set] #this doesn't work from the .exe either, but it doesn't crash the program
installed_packages.sort()
for pkg in installed_packages:
pkg = pkg.split(' ')
lines.append(diagpad(pkg[0]) + pkg[1])
return lines
if __name__ == "__main__":
raise AssertionError(f"Called main() on utility library {__file__}")