multiscript-windows 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscript-windows
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A lightweight wrapper to run Batch and VBScript within Python.
5
5
  Author-email: KingTheCoder <kingjd490@gmail.com>
6
6
  License: GPL-3.0-only
@@ -84,6 +84,10 @@ All of the versions of multiscript.
84
84
 
85
85
  Fixed a bug where enabling `showreturncode` for the `vbscript` function would cause a `TypeError`.
86
86
 
87
+ ## 1.0.2
88
+
89
+ Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
90
+
87
91
  ## Some Extra
88
92
 
89
93
  Hey, thanks for reading all the way to the end!
@@ -68,6 +68,10 @@ All of the versions of multiscript.
68
68
 
69
69
  Fixed a bug where enabling `showreturncode` for the `vbscript` function would cause a `TypeError`.
70
70
 
71
+ ## 1.0.2
72
+
73
+ Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
74
+
71
75
  ## Some Extra
72
76
 
73
77
  Hey, thanks for reading all the way to the end!
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "multiscript-windows"
7
- version = "1.0.1"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  { name="KingTheCoder", email="kingjd490@gmail.com" },
10
10
  ]
@@ -1,16 +1,19 @@
1
- import os
2
- import subprocess
1
+ import os, subprocess, uuid
2
+
3
+ def gentempname(ext):
4
+ return "tmp_" + uuid.uuid4().hex[:16] + ext
3
5
 
4
6
  def batchscript(scr, err=False, rcd=False):
5
- with open("temp.bat", "w") as batfile:
7
+ fname = gentempname(".bat")
8
+ with open(fname, "w") as batfile:
6
9
  batfile.write(scr)
7
- snd = subprocess.run(["cmd.exe", "/c", "temp.bat"], capture_output=True, text=True)
10
+ snd = subprocess.run(["cmd.exe", "/c", fname], capture_output=True, text=True)
8
11
  rtn = snd.stdout
9
12
  if err:
10
13
  rtn = (rtn + "\n" + snd.stderr)
11
14
  if rcd:
12
15
  rtn = (rtn + "\n" + str(snd.returncode))
13
- os.remove("temp.bat")
16
+ os.remove(fname)
14
17
  return rtn
15
18
  def commandlist():
16
19
  print(
@@ -26,16 +29,17 @@ The usewscript argument controls if cscript or wscript is used to execute.
26
29
  """
27
30
  )
28
31
  def vbscript(scr, err=False, rcd=False, wsc=False):
29
- with open("temp.vbs", "w") as vbsfile:
32
+ fname = gentempname(".vbs")
33
+ with open(fname, "w") as vbsfile:
30
34
  vbsfile.write(scr)
31
35
  if wsc:
32
- snd = subprocess.run(["wscript.exe", "temp.vbs"], capture_output=True, text=True)
36
+ snd = subprocess.run(["wscript.exe", fname], capture_output=True, text=True)
33
37
  else:
34
- snd = subprocess.run(["cscript.exe", "//Nologo", "temp.vbs"], capture_output=True, text=True)
38
+ snd = subprocess.run(["cscript.exe", "//Nologo", fname], capture_output=True, text=True)
35
39
  rtn = snd.stdout
36
40
  if err:
37
41
  rtn = (rtn + "\n" + snd.stderr)
38
42
  if rcd:
39
43
  rtn = (rtn + "\n" + str(snd.returncode))
40
- os.remove("temp.vbs")
44
+ os.remove(fname)
41
45
  return rtn
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscript-windows
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A lightweight wrapper to run Batch and VBScript within Python.
5
5
  Author-email: KingTheCoder <kingjd490@gmail.com>
6
6
  License: GPL-3.0-only
@@ -84,6 +84,10 @@ All of the versions of multiscript.
84
84
 
85
85
  Fixed a bug where enabling `showreturncode` for the `vbscript` function would cause a `TypeError`.
86
86
 
87
+ ## 1.0.2
88
+
89
+ Fixed a bug where running two of the same script at the same time would overwrite temp file A with temp file B.
90
+
87
91
  ## Some Extra
88
92
 
89
93
  Hey, thanks for reading all the way to the end!