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 @@ @@ -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"
$install_dir = "C:\Python311"
@ -27,5 +27,11 @@ Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install packaging" @@ -27,5 +27,11 @@ Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install packaging"
Write-Output "Installing setuptools"
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"
Start-Process "$install_dir\python.exe" -ArgumentList "-m pip install py2exe" -Wait

10
setup.py

@ -15,6 +15,8 @@ sys.argv.append("py2exe") @@ -15,6 +15,8 @@ sys.argv.append("py2exe")
PYTHON_PATH = r"C:\Python311"
WINDOWS_PATH = r"C:\Windows"
SETUP_DICT = {
"console": [{
@ -30,14 +32,18 @@ SETUP_DICT = { @@ -30,14 +32,18 @@ SETUP_DICT = {
("", glob(os.path.join(WINDOWS_PATH, r"SYSTEM32\msvcp100.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": {
"py2exe": {
"bundle_files": 3,
"excludes": ["tcl", "tk", "tkinter", "idna", "lib2to3", "xmlrpc", "multiprocessing", "urllib3", "chardet",
"asyncio", "pydoc_data", "requests", "unittest", "pydoc", "lzma", "bz2"],
"includes": ["charset_normalizer"],
"excludes": ["tcl", "tk", "tkinter", "lib2to3", "xmlrpc", "multiprocessing", "asyncio", "pydoc_data", "unittest", "pydoc", "lzma", "bz2"],
"dll_excludes": ["tcl86.dll", "tk86.dll"],
"compressed": True,
"optimize": 2

6
speedtest.py

@ -75,9 +75,8 @@ def get_client(config: ConfigParser): @@ -75,9 +75,8 @@ def get_client(config: ConfigParser):
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)
email_content = ""
for message in messages:
if not message.contents:
continue
@ -93,7 +92,6 @@ def send_data(config: ConfigParser, body: str, messages: list): @@ -93,7 +92,6 @@ def send_data(config: ConfigParser, body: str, messages: list):
texts = body.text
for text in texts:
content_, args = text.content, text.args
print("args", args)
email_content += content_.format(*text.args)
email_content += "\n"
@ -230,7 +228,7 @@ def main(): @@ -230,7 +228,7 @@ def main():
raise RuntimeError("No tests performed!")
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)
logger.info("Done! You're amazing!")

Loading…
Cancel
Save