Compare commits

...

2 Commits

Author SHA1 Message Date
John Smith dadaed4288 Fix building under windows 3 weeks ago
John Smith 4219128644 Add ISP and user name to the email 3 weeks ago
  1. 8
      bootstrap.ps1
  2. 0
      setup.bat
  3. 10
      setup.py
  4. 6
      speedtest.py

8
bootstrap.ps1

@ -1,4 +1,4 @@
$url = "https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe" $url = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe"
$output = "python311_installer.exe" $output = "python311_installer.exe"
$install_dir = "C:\Python311" $install_dir = "C:\Python311"
@ -27,5 +27,11 @@ Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install packaging"
Write-Output "Installing setuptools" Write-Output "Installing setuptools"
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install setuptools" -Wait Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install setuptools" -Wait
Write-Output "Installing requests"
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install requests" -Wait
Write-Output "Installing chardet"
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install chardet" -Wait
Write-Output "Installing py2exe" Write-Output "Installing py2exe"
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install py2exe" -Wait Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install py2exe" -Wait

10
setup.py

@ -15,6 +15,8 @@ sys.argv.append("py2exe")
PYTHON_PATH = r"C:\Python311" PYTHON_PATH = r"C:\Python311"
WINDOWS_PATH = r"C:\Windows"
SETUP_DICT = { SETUP_DICT = {
"console": [{ "console": [{
@ -30,14 +32,18 @@ SETUP_DICT = {
("", glob(os.path.join(WINDOWS_PATH, r"SYSTEM32\msvcp100.dll"))), ("", glob(os.path.join(WINDOWS_PATH, r"SYSTEM32\msvcp100.dll"))),
("", glob(os.path.join(WINDOWS_PATH, r"SYSTEM32\msvcr100.dll"))), ("", glob(os.path.join(WINDOWS_PATH, r"SYSTEM32\msvcr100.dll"))),
("", glob(os.path.join(os.getcwd(), r"speedtest.ini"))),
("", glob(os.path.join(os.getcwd(), r"urls.txt"))),
("library", glob(os.path.join(os.getcwd(), r"library/commons.py"))),
("library", glob(os.path.join(os.getcwd(), r"library/inputimeout.py"))),
], ],
"options": { "options": {
"py2exe": { "py2exe": {
"bundle_files": 3, "bundle_files": 3,
"excludes": ["tcl", "tk", "tkinter", "idna", "lib2to3", "xmlrpc", "multiprocessing", "urllib3", "chardet", "includes": ["charset_normalizer"],
"asyncio", "pydoc_data", "requests", "unittest", "pydoc", "lzma", "bz2"], "excludes": ["tcl", "tk", "tkinter", "lib2to3", "xmlrpc", "multiprocessing", "asyncio", "pydoc_data", "unittest", "pydoc", "lzma", "bz2"],
"dll_excludes": ["tcl86.dll", "tk86.dll"], "dll_excludes": ["tcl86.dll", "tk86.dll"],
"compressed": True, "compressed": True,
"optimize": 2 "optimize": 2

6
speedtest.py

@ -75,9 +75,8 @@ def get_client(config: ConfigParser):
return client return client
def send_data(config: ConfigParser, body: str, messages: list): def send_data(config: ConfigParser, email_content: str, messages: list):
client = get_client(config) client = get_client(config)
email_content = ""
for message in messages: for message in messages:
if not message.contents: if not message.contents:
continue continue
@ -93,7 +92,6 @@ def send_data(config: ConfigParser, body: str, messages: list):
texts = body.text texts = body.text
for text in texts: for text in texts:
content_, args = text.content, text.args content_, args = text.content, text.args
print("args", args)
email_content += content_.format(*text.args) email_content += content_.format(*text.args)
email_content += "\n" email_content += "\n"
@ -230,7 +228,7 @@ def main():
raise RuntimeError("No tests performed!") raise RuntimeError("No tests performed!")
client = get_client(mail_section) client = get_client(mail_section)
body = "User name: %s; ISP: %s" % (name, isp) body = "# User name: %s; ISP: %s\n" % (name, isp)
send_data(mail_section, body, messages) send_data(mail_section, body, messages)
logger.info("Done! You're amazing!") logger.info("Done! You're amazing!")

Loading…
Cancel
Save