psytricks 2.1.6__tar.gz → 2.2.0__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.
@@ -0,0 +1,41 @@
1
+ # 🏗️ ResTricks Service Installation / Upgrade TL;DR ⏩
2
+
3
+ The commands below can be used to upgrade an existing installation of the
4
+ `ResTricksService` - for a *fresh* installation you'd also need to create the
5
+ target location and adjust the configuration in `restricks-server.xml`.
6
+
7
+ ```PowerShell
8
+ # adjust the version and path variables to your preferences:
9
+ $PSyTricksTag = "v2.2.0.a21"
10
+ $PSyTricksVersion = "2.2.0a21"
11
+ $TargetDir = "C:\ProgramData\PSyTricks"
12
+
13
+ # this one usually doesn't require changes:
14
+ $WinSwVersion = "WinSW.NET461-2.12.0"
15
+
16
+ $PSyTricksPkg = "psytricks-REST-${PSyTricksVersion}_${WinSwVersion}"
17
+ $PSyTricksZip = "${PSyTricksPkg}.zip"
18
+ $PSyTricksBaseDl = "https://github.com/imcf/psytricks/releases/download"
19
+ $PSyTricksUri = "${PSyTricksBaseDl}/${PSyTricksTag}/${PSyTricksZip}"
20
+
21
+ Set-Location "C:\Temp\"
22
+
23
+ Invoke-WebRequest -Uri $PSyTricksUri -OutFile $PSyTricksZip
24
+ Expand-Archive $PSyTricksZip -DestinationPath .
25
+ Set-Location $PSyTricksPkg
26
+ # when upgrading, simply remove the example config - for an initial installation
27
+ # move it to the target location and rename it to "restricks-server.xml":
28
+ Remove-Item restricks-server.example.xml
29
+
30
+ Stop-Service RESTricksServer
31
+ Get-Service RESTricksServer
32
+
33
+ foreach ($File in Get-ChildItem -File) {
34
+ Unblock-File -Path $File.FullName
35
+ Move-Item -Path $File.FullName -Destination $TargetDir -Force
36
+ }
37
+
38
+ Start-Service RESTricksServer
39
+ Get-Service RESTricksServer
40
+ Get-Content -Tail 10 "${TargetDir}\restricks-server.wrapper.log"
41
+ ```
@@ -1,9 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: psytricks
3
+ Version: 2.2.0
4
+ Summary: PowerShell Python Citrix Tricks.
5
+ License-Expression: GPL-3.0-or-later
6
+ License-File: LICENSE
7
+ Author: Niko Ehrenfeuchter
8
+ Author-email: nikolaus.ehrenfeuchter@unibas.ch
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Dist: click (>=8.1.3,<9.0.0)
18
+ Requires-Dist: loguru (>=0.7.0,<0.8.0)
19
+ Requires-Dist: requests (>=2.30.0,<3.0.0)
20
+ Project-URL: Changelog, https://github.com/imcf/psytricks/blob/main/CHANGELOG.md
21
+ Project-URL: Documentation, https://imcf.one/apidocs/psytricks/psytricks.html
22
+ Project-URL: Organisation Homepage, https://imcf.one/
23
+ Description-Content-Type: text/markdown
24
+
1
25
  # PSytricks
2
26
 
3
- ![PyPI](https://img.shields.io/pypi/v/psytricks)
27
+ [![PyPI](https://img.shields.io/pypi/v/psytricks)](https://pypi.org/project/psytricks/)
4
28
  ![PyPI - License](https://img.shields.io/pypi/l/psytricks)
5
- ![pdoc](https://img.shields.io/badge/docs-pdoc-brightgreen.svg)
6
- ![black](https://img.shields.io/badge/code%20style-black-000000.svg)
29
+ [![pdoc](https://img.shields.io/badge/docs-pdoc-brightgreen.svg)](https://imcf.one/apidocs/psytricks)
30
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7
31
 
8
32
  `P`ower`S`hell P`y`thon Ci`tri`x Tri`cks` - pun intended.
9
33
 
@@ -18,7 +42,7 @@ there) is required.
18
42
 
19
43
  PSyTricks ships with two options for the PowerShell layer:
20
44
 
21
- * A wrapper script that is launched as a suprocess from the Python code. It
45
+ * A wrapper script that is launched as a subprocess from the Python code. It
22
46
  doesn't require any further setup beyond the package installation but
23
47
  performance, well, slow.
24
48
  * A (zero-authentication) `REST` (see the note below on this) service providing
@@ -27,10 +51,11 @@ PSyTricks ships with two options for the PowerShell layer:
27
51
  obviously this requires the code to be running as a service in an appropriate
28
52
  permission context.
29
53
 
30
- NOTE: this `RESTful` claim is actually not entirely true. Or basically not at
31
- all, it would be better called an `HTTP-JSON-RPC-API`. We'll still be using the
32
- term `REST` for it as this is basically what people nowadays think of when they
33
- are coming across this label. Sorry, [Roy T. Fielding][www_rtf].
54
+ NOTE: this `RESTful` claim isn't fully true. Or actually not at all, it would be
55
+ better called an `HTTP-JSON-RPC-API`. For now, we'll still be using the term
56
+ `REST` for it as the functionality of this package basically serves a very
57
+ similar purpose to what people think of when they are coming across this label.
58
+ Apologies, [Roy T. Fielding][www_rtf].
34
59
 
35
60
  ## 🤯 Are you serious?
36
61
 
@@ -42,7 +67,7 @@ Really? 🧐
42
67
  Or, not sure if that's any better, implementing an HTTP REST API in plain
43
68
  PowerShell?!? 🫣
44
69
 
45
- ### ✅ Yes. We. Are
70
+ ### ✅ Yes, we are
46
71
 
47
72
  *And the package name was chosen to reflect this.*
48
73
 
@@ -51,9 +76,9 @@ at all* an issue for us. Abysmal, as in: for every wrapped call a full (new)
51
76
  PowerShell process needs to be instantiated, usually taking something like 1-2
52
77
  seconds. ⏳
53
78
 
54
- The REST interface provides a much better performance, at the cost of some
55
- additional setup. If you're happy to take on this approach, the package offers a
56
- very smooth ride. 🎢🎡
79
+ The REST / HTTP-RPC interface provides a much better performance, at the cost of
80
+ some additional setup. If you're happy to take on this approach, the package
81
+ offers a very smooth ride. 🎢🎡
57
82
 
58
83
  ## 🛠🚧 Installation
59
84
 
@@ -73,7 +98,7 @@ Controller` or `XenDesktop` installation media and install it as usual:
73
98
 
74
99
  * `Broker_PowerShellSnapIn_x64.msi`
75
100
 
76
- ### Installing the 🐍 package
101
+ ### Installing the 🐍 Python package
77
102
 
78
103
  In case you're planning to use `psytricks` via the subprocess approach
79
104
  (discouraged but less components to set up), you will have to install the
@@ -94,14 +119,24 @@ commands provided by the PowerShell snap-in could be used directly.
94
119
 
95
120
  ### Setting up the REST service
96
121
 
97
- The easiest way for installing the REST service is to use [WinSW (Windows
98
- Service Wrapper)][www_winsw] but you may choose anything you like to launch the
99
- server process like NSSM, Scheduled Tasks 📅, homegrown dark magic 🪄🔮 or
100
- others.
122
+ 💡 When using the `ResTricksService` (recommended), only that service itself
123
+ needs to run on a Windows machine having the *Citrix Broker PowerShell Snap-In*
124
+ installed - the 🐍 Python package can then be used from any (Linux, ...) system
125
+ that is able to connect to the service!
126
+
127
+ The currently recommended way for installing the `ResTricksService` is using
128
+ [WinSW (Windows Service Wrapper)][www_winsw] but you may choose anything you
129
+ like to launch the server process like NSSM, Scheduled Tasks 📅, homegrown dark
130
+ magic 🪄🔮 or others.
131
+
132
+ 🧪 A more recent approach could be [Shawl][www_shawl] - let us know if you've
133
+ tried it and how it went!
101
134
 
102
135
  To go with **WinSW** simply download the bundled version provided with each
103
136
  [PSyTricks release][www_releases]. Just look for the `.zip` asset having `REST`
104
- and `WinSW` in its name.
137
+ and `WinSW` in its name, matching your .NET version.
138
+
139
+ #### 🔧 Configuration
105
140
 
106
141
  Unzip the downloaded file to the desired target location, e.g.
107
142
  `%PROGRAMDATA%\PSyTricks`, then copy / rename `restricks-server.example.xml` to
@@ -112,11 +147,30 @@ and make sure to update the hostname passed via the `-AdminAddress` parameter in
112
147
  the `<startarguments>` section. It needs to point to your Citrix Delivery
113
148
  Controller, just in case that's not obvious.
114
149
 
115
- Next step is to install and start the service:
150
+ #### 🛑⚠️🛑 Enable execution
151
+
152
+ Depending on the security policies in place on your system, the service
153
+ components need to be explicitly unblocked before the service can be started. To
154
+ do this, run the following commands:
116
155
 
117
156
  ```PowerShell
118
- cd C:\ProgramData\PSyTricks
119
- restricks-server.exe isntall
157
+ cd C:\ProgramData\PSyTricks # or wherever you're installing to
158
+ Unblock-File .\psytricks-lib.ps1
159
+ Unblock-File .\restricks-server.ps1
160
+ Unblock-File .\restricks-server.exe
161
+ ```
162
+
163
+ 💡 Those steps also need to be performed when **upgrading** the service, which
164
+ is done by replacing exactly the files listed above. For a *TL;DR* summary on
165
+ downloading, extracting and upgrading an installation, see the
166
+ [installation / upgrade instructions](INSTALLATION.md).
167
+
168
+ #### ☑️ Register and 🏃🏼‍♀️‍➡️ run it
169
+
170
+ The final step is to install and start the service:
171
+
172
+ ```PowerShell
173
+ .\restricks-server.exe install
120
174
  Start-Service RESTricksServer
121
175
  ```
122
176
 
@@ -135,7 +189,9 @@ Tada! That's it, the service is now ready to take HTTP requests (from
135
189
 
136
190
  Please be aware that the REST interface doesn't do **any authentication** on
137
191
  purpose, meaning everything / everyone that can access it will be able to run
138
- all requests! We're using it in combination with an SSH tunnel but essentially
192
+ all requests!
193
+
194
+ We're using it in combination with an 🔐🌐 **SSH tunnel** but essentially
139
195
  anything that controls who / what can access the service will do the job.
140
196
 
141
197
  ## 🎪 What does it provide?
@@ -202,3 +258,47 @@ wrapper.set_maintenance(machine="vm42.vdi.example.xy", disable=False)
202
258
  [www_winsw]: https://github.com/winsw/winsw
203
259
  [www_releases]: https://github.com/imcf/psytricks/releases
204
260
  [www_rtf]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
261
+ [www_shawl]: https://github.com/mtkennerly/shawl
262
+
263
+ # 🏗️ ResTricks Service Installation / Upgrade TL;DR ⏩
264
+
265
+ The commands below can be used to upgrade an existing installation of the
266
+ `ResTricksService` - for a *fresh* installation you'd also need to create the
267
+ target location and adjust the configuration in `restricks-server.xml`.
268
+
269
+ ```PowerShell
270
+ # adjust the version and path variables to your preferences:
271
+ $PSyTricksTag = "v2.2.0.a21"
272
+ $PSyTricksVersion = "2.2.0a21"
273
+ $TargetDir = "C:\ProgramData\PSyTricks"
274
+
275
+ # this one usually doesn't require changes:
276
+ $WinSwVersion = "WinSW.NET461-2.12.0"
277
+
278
+ $PSyTricksPkg = "psytricks-REST-${PSyTricksVersion}_${WinSwVersion}"
279
+ $PSyTricksZip = "${PSyTricksPkg}.zip"
280
+ $PSyTricksBaseDl = "https://github.com/imcf/psytricks/releases/download"
281
+ $PSyTricksUri = "${PSyTricksBaseDl}/${PSyTricksTag}/${PSyTricksZip}"
282
+
283
+ Set-Location "C:\Temp\"
284
+
285
+ Invoke-WebRequest -Uri $PSyTricksUri -OutFile $PSyTricksZip
286
+ Expand-Archive $PSyTricksZip -DestinationPath .
287
+ Set-Location $PSyTricksPkg
288
+ # when upgrading, simply remove the example config - for an initial installation
289
+ # move it to the target location and rename it to "restricks-server.xml":
290
+ Remove-Item restricks-server.example.xml
291
+
292
+ Stop-Service RESTricksServer
293
+ Get-Service RESTricksServer
294
+
295
+ foreach ($File in Get-ChildItem -File) {
296
+ Unblock-File -Path $File.FullName
297
+ Move-Item -Path $File.FullName -Destination $TargetDir -Force
298
+ }
299
+
300
+ Start-Service RESTricksServer
301
+ Get-Service RESTricksServer
302
+ Get-Content -Tail 10 "${TargetDir}\restricks-server.wrapper.log"
303
+ ```
304
+
@@ -1,31 +1,9 @@
1
- Metadata-Version: 2.1
2
- Name: psytricks
3
- Version: 2.1.6
4
- Summary: PowerShell Python Citrix Tricks.
5
- License: GPL-3.0-or-later
6
- Author: Niko Ehrenfeuchter
7
- Author-email: nikolaus.ehrenfeuchter@unibas.ch
8
- Requires-Python: >=3.9,<4.0
9
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Requires-Dist: click (>=8.1.3,<9.0.0)
15
- Requires-Dist: loguru (>=0.7.0,<0.8.0)
16
- Requires-Dist: requests (>=2.30.0,<3.0.0)
17
- Project-URL: Changelog, https://github.com/imcf/psytricks/blob/main/CHANGELOG.md
18
- Project-URL: Documentation, https://imcf.one/apidocs/psytricks/psytricks.html
19
- Project-URL: Organisation Homepage, https://imcf.one/
20
- Project-URL: Twitter, https://twitter.com/imcf_basel
21
- Description-Content-Type: text/markdown
22
-
23
1
  # PSytricks
24
2
 
25
- ![PyPI](https://img.shields.io/pypi/v/psytricks)
3
+ [![PyPI](https://img.shields.io/pypi/v/psytricks)](https://pypi.org/project/psytricks/)
26
4
  ![PyPI - License](https://img.shields.io/pypi/l/psytricks)
27
- ![pdoc](https://img.shields.io/badge/docs-pdoc-brightgreen.svg)
28
- ![black](https://img.shields.io/badge/code%20style-black-000000.svg)
5
+ [![pdoc](https://img.shields.io/badge/docs-pdoc-brightgreen.svg)](https://imcf.one/apidocs/psytricks)
6
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
29
7
 
30
8
  `P`ower`S`hell P`y`thon Ci`tri`x Tri`cks` - pun intended.
31
9
 
@@ -40,7 +18,7 @@ there) is required.
40
18
 
41
19
  PSyTricks ships with two options for the PowerShell layer:
42
20
 
43
- * A wrapper script that is launched as a suprocess from the Python code. It
21
+ * A wrapper script that is launched as a subprocess from the Python code. It
44
22
  doesn't require any further setup beyond the package installation but
45
23
  performance, well, slow.
46
24
  * A (zero-authentication) `REST` (see the note below on this) service providing
@@ -49,10 +27,11 @@ PSyTricks ships with two options for the PowerShell layer:
49
27
  obviously this requires the code to be running as a service in an appropriate
50
28
  permission context.
51
29
 
52
- NOTE: this `RESTful` claim is actually not entirely true. Or basically not at
53
- all, it would be better called an `HTTP-JSON-RPC-API`. We'll still be using the
54
- term `REST` for it as this is basically what people nowadays think of when they
55
- are coming across this label. Sorry, [Roy T. Fielding][www_rtf].
30
+ NOTE: this `RESTful` claim isn't fully true. Or actually not at all, it would be
31
+ better called an `HTTP-JSON-RPC-API`. For now, we'll still be using the term
32
+ `REST` for it as the functionality of this package basically serves a very
33
+ similar purpose to what people think of when they are coming across this label.
34
+ Apologies, [Roy T. Fielding][www_rtf].
56
35
 
57
36
  ## 🤯 Are you serious?
58
37
 
@@ -64,7 +43,7 @@ Really? 🧐
64
43
  Or, not sure if that's any better, implementing an HTTP REST API in plain
65
44
  PowerShell?!? 🫣
66
45
 
67
- ### ✅ Yes. We. Are
46
+ ### ✅ Yes, we are
68
47
 
69
48
  *And the package name was chosen to reflect this.*
70
49
 
@@ -73,9 +52,9 @@ at all* an issue for us. Abysmal, as in: for every wrapped call a full (new)
73
52
  PowerShell process needs to be instantiated, usually taking something like 1-2
74
53
  seconds. ⏳
75
54
 
76
- The REST interface provides a much better performance, at the cost of some
77
- additional setup. If you're happy to take on this approach, the package offers a
78
- very smooth ride. 🎢🎡
55
+ The REST / HTTP-RPC interface provides a much better performance, at the cost of
56
+ some additional setup. If you're happy to take on this approach, the package
57
+ offers a very smooth ride. 🎢🎡
79
58
 
80
59
  ## 🛠🚧 Installation
81
60
 
@@ -95,7 +74,7 @@ Controller` or `XenDesktop` installation media and install it as usual:
95
74
 
96
75
  * `Broker_PowerShellSnapIn_x64.msi`
97
76
 
98
- ### Installing the 🐍 package
77
+ ### Installing the 🐍 Python package
99
78
 
100
79
  In case you're planning to use `psytricks` via the subprocess approach
101
80
  (discouraged but less components to set up), you will have to install the
@@ -116,14 +95,24 @@ commands provided by the PowerShell snap-in could be used directly.
116
95
 
117
96
  ### Setting up the REST service
118
97
 
119
- The easiest way for installing the REST service is to use [WinSW (Windows
120
- Service Wrapper)][www_winsw] but you may choose anything you like to launch the
121
- server process like NSSM, Scheduled Tasks 📅, homegrown dark magic 🪄🔮 or
122
- others.
98
+ 💡 When using the `ResTricksService` (recommended), only that service itself
99
+ needs to run on a Windows machine having the *Citrix Broker PowerShell Snap-In*
100
+ installed - the 🐍 Python package can then be used from any (Linux, ...) system
101
+ that is able to connect to the service!
102
+
103
+ The currently recommended way for installing the `ResTricksService` is using
104
+ [WinSW (Windows Service Wrapper)][www_winsw] but you may choose anything you
105
+ like to launch the server process like NSSM, Scheduled Tasks 📅, homegrown dark
106
+ magic 🪄🔮 or others.
107
+
108
+ 🧪 A more recent approach could be [Shawl][www_shawl] - let us know if you've
109
+ tried it and how it went!
123
110
 
124
111
  To go with **WinSW** simply download the bundled version provided with each
125
112
  [PSyTricks release][www_releases]. Just look for the `.zip` asset having `REST`
126
- and `WinSW` in its name.
113
+ and `WinSW` in its name, matching your .NET version.
114
+
115
+ #### 🔧 Configuration
127
116
 
128
117
  Unzip the downloaded file to the desired target location, e.g.
129
118
  `%PROGRAMDATA%\PSyTricks`, then copy / rename `restricks-server.example.xml` to
@@ -134,11 +123,30 @@ and make sure to update the hostname passed via the `-AdminAddress` parameter in
134
123
  the `<startarguments>` section. It needs to point to your Citrix Delivery
135
124
  Controller, just in case that's not obvious.
136
125
 
137
- Next step is to install and start the service:
126
+ #### 🛑⚠️🛑 Enable execution
127
+
128
+ Depending on the security policies in place on your system, the service
129
+ components need to be explicitly unblocked before the service can be started. To
130
+ do this, run the following commands:
138
131
 
139
132
  ```PowerShell
140
- cd C:\ProgramData\PSyTricks
141
- restricks-server.exe isntall
133
+ cd C:\ProgramData\PSyTricks # or wherever you're installing to
134
+ Unblock-File .\psytricks-lib.ps1
135
+ Unblock-File .\restricks-server.ps1
136
+ Unblock-File .\restricks-server.exe
137
+ ```
138
+
139
+ 💡 Those steps also need to be performed when **upgrading** the service, which
140
+ is done by replacing exactly the files listed above. For a *TL;DR* summary on
141
+ downloading, extracting and upgrading an installation, see the
142
+ [installation / upgrade instructions](INSTALLATION.md).
143
+
144
+ #### ☑️ Register and 🏃🏼‍♀️‍➡️ run it
145
+
146
+ The final step is to install and start the service:
147
+
148
+ ```PowerShell
149
+ .\restricks-server.exe install
142
150
  Start-Service RESTricksServer
143
151
  ```
144
152
 
@@ -157,7 +165,9 @@ Tada! That's it, the service is now ready to take HTTP requests (from
157
165
 
158
166
  Please be aware that the REST interface doesn't do **any authentication** on
159
167
  purpose, meaning everything / everyone that can access it will be able to run
160
- all requests! We're using it in combination with an SSH tunnel but essentially
168
+ all requests!
169
+
170
+ We're using it in combination with an 🔐🌐 **SSH tunnel** but essentially
161
171
  anything that controls who / what can access the service will do the job.
162
172
 
163
173
  ## 🎪 What does it provide?
@@ -224,4 +234,4 @@ wrapper.set_maintenance(machine="vm42.vdi.example.xy", disable=False)
224
234
  [www_winsw]: https://github.com/winsw/winsw
225
235
  [www_releases]: https://github.com/imcf/psytricks/releases
226
236
  [www_rtf]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
227
-
237
+ [www_shawl]: https://github.com/mtkennerly/shawl
@@ -0,0 +1,73 @@
1
+ [project]
2
+ name = "psytricks"
3
+ description = "PowerShell Python Citrix Tricks."
4
+ authors = [
5
+ { name = "Niko Ehrenfeuchter", email = "nikolaus.ehrenfeuchter@unibas.ch" },
6
+ ]
7
+ license = "GPL-3.0-or-later"
8
+ dynamic = ["readme"]
9
+ version = "2.2.0"
10
+
11
+ [tool.poetry]
12
+ documentation = "https://imcf.one/apidocs/psytricks/psytricks.html"
13
+ readme = ["README.md", "INSTALLATION.md"]
14
+
15
+ [tool.poetry.urls]
16
+ "Changelog" = "https://github.com/imcf/psytricks/blob/main/CHANGELOG.md"
17
+ "Organisation Homepage" = "https://imcf.one/"
18
+
19
+ [tool.poetry.dependencies]
20
+ click = "^8.1.3"
21
+ loguru = "^0.7.0"
22
+ python = "^3.9"
23
+ requests = "^2.30.0"
24
+
25
+ [tool.poetry.group.dev.dependencies]
26
+ black = "^23.1.0"
27
+ ipython = "^8.13.2"
28
+ pylint = "^2.16.2"
29
+
30
+ [tool.poetry.scripts]
31
+ psytricks = "psytricks.cli:run_cli"
32
+
33
+ [tool.poetry.requires-plugins]
34
+ poetry-dynamic-versioning = { version = ">=1.0.0,<2.0.0", extras = ["plugin"] }
35
+
36
+ [tool.poetry-dynamic-versioning]
37
+ enable = false
38
+ style = "semver"
39
+ vcs = "git"
40
+
41
+ [tool.poetry-dynamic-versioning.substitution]
42
+ folders = [
43
+ {path = "src"},
44
+ {path = "src/psytricks/__ps1__", files = ["*.ps1"], patterns = ['(^\$Version = ["])[^"]*(["])']},
45
+ ]
46
+
47
+ [build-system]
48
+ build-backend = "poetry_dynamic_versioning.backend"
49
+ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
50
+
51
+ [tool.ruff.lint]
52
+ # exclude = [
53
+ # "tests/foo/*"
54
+ # ]
55
+
56
+ select = [
57
+ "D",
58
+ "D203", # blank line required before class docstring
59
+ "D212", # summary lines must be on the first physical line of the docstring
60
+ "D401", # imperative mood for all docstrings
61
+ "D415", # summary line has to end in a punctuation mark
62
+ "D417", # require documentation for _all_ function parameters
63
+ ]
64
+
65
+ ignore = [
66
+ "D202", # no blank lines allowed after function docstring
67
+ ## D211 conflicts with ruff's formatting as of 2025-04-14, so don't use it:
68
+ # "D211", # no blank lines allowed before class docstring
69
+ ]
70
+
71
+
72
+ [tool.ruff.lint.pydocstyle]
73
+ convention = "numpy"
@@ -0,0 +1,10 @@
1
+ """.. include:: ../../README.md
2
+
3
+ .. include:: ../../CHANGELOG.md
4
+ """
5
+
6
+ __version__ = "2.2.0"
7
+
8
+ # style exceptions for pdoc-include-only docstrings:
9
+ # ruff: noqa: D400 (missing-trailing-period)
10
+ # ruff: noqa: D415 (missing-terminal-punctuation)
@@ -5,7 +5,7 @@ Collection of functions and other definitions to be sourced by other scripts.
5
5
  #>
6
6
 
7
7
  # the version variable will be filled by poetry at build time:
8
- $Version = "2.1.6"
8
+ $Version = "2.2.0"
9
9
 
10
10
 
11
11
  #region properties-selectors
@@ -26,7 +26,7 @@ param (
26
26
 
27
27
  [Parameter(
28
28
  ParameterSetName = "Startup",
29
- HelpMessage = "A logfile to use for the output (default: stdtout)."
29
+ HelpMessage = "A logfile to use for the output (default: stdout)."
30
30
  )]
31
31
  [string]
32
32
  $LogFile,
@@ -93,7 +93,7 @@ if ($Shutdown) {
93
93
  Stop-Process -Name "restricks-server" -ErrorAction SilentlyContinue
94
94
  }
95
95
  } catch {
96
- Write-Host "Issue shutting down: $_"
96
+ Write-Host "[$(Format-Date)] Issue shutting down: $_"
97
97
  } finally {
98
98
  exit
99
99
  }
@@ -169,7 +169,7 @@ function Send-Response {
169
169
 
170
170
  [Parameter(HelpMessage = "An error message for the 'Status' JSON section.")]
171
171
  [string]
172
- $ErrorMesage = "",
172
+ $ErrorMessage = "",
173
173
 
174
174
  [Parameter(HelpMessage = "Use 'text/html' instead of 'application/json'.")]
175
175
  [Switch]
@@ -182,7 +182,7 @@ function Send-Response {
182
182
  } else {
183
183
  $Status = @{
184
184
  ExecutionStatus = $ExecutionStatus
185
- ErrorMessage = $ErrorMesage
185
+ ErrorMessage = $ErrorMessage
186
186
  ScriptName = $ScriptName
187
187
  ScriptPath = $ScriptPath
188
188
  PSyTricksVersion = $Version
@@ -450,7 +450,7 @@ function Start-ListenerBlocking {
450
450
  -Response $Response `
451
451
  -StatusCode 400 `
452
452
  -ExecutionStatus 1 `
453
- -ErrorMesage $_ `
453
+ -ErrorMessage $_ `
454
454
  -Body $Message
455
455
  } catch {
456
456
  Write-Host "Unable to send the response: $_" @Red
@@ -474,6 +474,7 @@ function Start-ListenerBlocking {
474
474
 
475
475
  function Start-ListenerLoop {
476
476
  Write-Host "====================================================" @Blue
477
+ Write-Host "$(Format-Date)" @Blue
477
478
  Write-Host "Starting: $ScriptPath" @Blue
478
479
  Write-Host "PSyTricksVersion: $Version" @Blue
479
480
  Write-Host "Citrix 'AdminAddress': $AdminAddress" @Blue
@@ -495,7 +496,7 @@ function Start-ListenerLoop {
495
496
  Write-Host "====================================================" @Blue
496
497
  return
497
498
  }
498
- Write-Host "No shutdown file [$StopMarker] present." @Blue
499
+ Write-Host "[$(Format-Date)] No shutdown file [$StopMarker] present." @Blue
499
500
  Write-Host "Re-starting in 5s, press Ctrl+C to abort..." @Blue
500
501
  Start-Sleep -Seconds 5
501
502
  Write-Host "Wait-time elapsed, re-starting the listener..."
@@ -516,7 +517,7 @@ if ($LogFile -eq "") {
516
517
  } catch {
517
518
  throw "Unable to open log file for writing: [$LogFile]"
518
519
  }
519
- Write-Host "[$ScriptName] logs will go to [$LogFile]."
520
+ Write-Host "[$ScriptName] [$(Format-Date)] logs will go to [$LogFile]."
520
521
  # 'Write-Host' is writing to the 'Information' stream (which is #6), so we
521
522
  # need to redirect that one to the log file:
522
523
  Start-ListenerLoop 6>&1 | Out-File $LogFile -Encoding "utf8"
@@ -9,7 +9,9 @@ from .mappings import by_keyword
9
9
 
10
10
 
11
11
  def parse_powershell_json(json_dict):
12
- """Hook for `json.loads()` to process PowerShell 5.1 / Citrix JSON.
12
+ """Process PowerShell 5.1 / Citrix JSON.
13
+
14
+ Intended to be used as a hook for `json.loads()`.
13
15
 
14
16
  Windows PowerShell up to version 5.1 will produce strings in the format
15
17
  `/Date(<ms-since-epoch>)/` when converting a timestamp to JSON using the
@@ -44,7 +46,12 @@ def parse_powershell_json(json_dict):
44
46
  ret[key] = datetime.fromtimestamp(int(epoch_ms[:10]))
45
47
  elif key in by_keyword:
46
48
  mapping = by_keyword[key]
47
- mapped_value = mapping[value]
49
+ try:
50
+ mapped_value = mapping[value]
51
+ except KeyError as err:
52
+ mapped_value = f"undefined-mapping-{value}"
53
+ log.error(f"No mapping for value '{value}' - using '{mapped_value}'!")
54
+ log.trace(err)
48
55
  log.trace(f"{key}: {value} -> {mapped_value}")
49
56
  ret[key] = mapped_value
50
57
  else:
@@ -9,7 +9,8 @@ The dicts defined here can be used to map the numerical values back to their
9
9
  descriptive names. The mapped names are corresponding to the ones described in
10
10
  the official Citrix CVAD 2203 developer docs (all transformed to lowercase):
11
11
 
12
- https://developer-docs.citrix.com/projects/citrix-virtual-apps-desktops-sdk/en/2203/
12
+ * https://developer-docs.citrix.com/en-us/citrix-virtual-apps-desktops-sdk/2203/
13
+ * https://developer-docs.citrix.com/en-us/citrix-virtual-apps-desktops-sdk/2507/
13
14
  """
14
15
 
15
16
  #######################################################################################
@@ -25,6 +26,8 @@ power_state = {
25
26
  7: "turningoff",
26
27
  8: "suspending",
27
28
  9: "resuming",
29
+ 10: "notsupported",
30
+ 11: "virtualmachinenotfound",
28
31
  }
29
32
  """A machine's *power status* (`Citrix.Broker.Admin.SDK.PowerState`).
30
33