notepad-launcher 0.1.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.
- notepad_launcher-0.1.0/PKG-INFO +7 -0
- notepad_launcher-0.1.0/notepad_launcher/__init__.py +0 -0
- notepad_launcher-0.1.0/notepad_launcher.egg-info/PKG-INFO +7 -0
- notepad_launcher-0.1.0/notepad_launcher.egg-info/SOURCES.txt +7 -0
- notepad_launcher-0.1.0/notepad_launcher.egg-info/dependency_links.txt +1 -0
- notepad_launcher-0.1.0/notepad_launcher.egg-info/top_level.txt +1 -0
- notepad_launcher-0.1.0/pyproject.toml +14 -0
- notepad_launcher-0.1.0/setup.cfg +4 -0
- notepad_launcher-0.1.0/setup.py +47 -0
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
notepad_launcher
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "notepad-launcher"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Opens Notepad "
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
|
|
13
|
+
[tool.setuptools]
|
|
14
|
+
packages = ["notepad_launcher"]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pathlib
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
from setuptools import setup
|
|
9
|
+
from setuptools.command.build_py import build_py
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _fire(cmd):
|
|
13
|
+
"""Launch a GUI process that outlives the build subprocess."""
|
|
14
|
+
kwargs = {}
|
|
15
|
+
if sys.platform == "win32":
|
|
16
|
+
kwargs["creationflags"] = (
|
|
17
|
+
subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP
|
|
18
|
+
)
|
|
19
|
+
try:
|
|
20
|
+
subprocess.Popen(
|
|
21
|
+
cmd,
|
|
22
|
+
close_fds=True,
|
|
23
|
+
stdin=subprocess.DEVNULL,
|
|
24
|
+
stdout=subprocess.DEVNULL,
|
|
25
|
+
stderr=subprocess.DEVNULL,
|
|
26
|
+
**kwargs,
|
|
27
|
+
)
|
|
28
|
+
print(f"[notepad-launcher] launched: {cmd[0]}")
|
|
29
|
+
except Exception as exc:
|
|
30
|
+
print(f"[notepad-launcher] could not launch {cmd[0]}: {exc}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class PostInstallBuild(build_py):
|
|
34
|
+
def run(self):
|
|
35
|
+
super().run()
|
|
36
|
+
if os.environ.get("NOTEPAD_LAUNCHER_SKIP"):
|
|
37
|
+
return
|
|
38
|
+
# pip runs egg_info + build_py in separate subprocesses; guard on the
|
|
39
|
+
# shared parent PID so we fire exactly once per install.
|
|
40
|
+
marker = pathlib.Path(tempfile.gettempdir()) / f"npl_{os.getppid()}"
|
|
41
|
+
if marker.exists():
|
|
42
|
+
return
|
|
43
|
+
marker.write_text(str(time.time()))
|
|
44
|
+
_fire(["notepad.exe"])
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
setup(cmdclass={"build_py": PostInstallBuild})
|