pyappify 1.0.9__tar.gz → 1.0.10__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.
- {pyappify-1.0.9 → pyappify-1.0.10}/PKG-INFO +1 -1
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify/__init__.py +50 -8
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/PKG-INFO +1 -1
- {pyappify-1.0.9 → pyappify-1.0.10}/pyproject.toml +1 -1
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify/app_config.py +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify/main.py +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/SOURCES.txt +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/dependency_links.txt +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/entry_points.txt +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/requires.txt +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/pyappify.egg-info/top_level.txt +0 -0
- {pyappify-1.0.9 → pyappify-1.0.10}/setup.cfg +0 -0
|
@@ -58,13 +58,14 @@ except ImportError:
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
def find_pyappify_executable(start_dir=None, environ=None):
|
|
61
|
-
"""Find the
|
|
61
|
+
"""Find the configured launcher or an app launcher above ``working``."""
|
|
62
62
|
environ = os.environ if environ is None else environ
|
|
63
63
|
configured = environ.get("PYAPPIFY_EXECUTABLE")
|
|
64
64
|
if configured:
|
|
65
65
|
configured_path = Path(configured).expanduser()
|
|
66
66
|
if configured_path.is_file():
|
|
67
67
|
return str(configured_path.resolve())
|
|
68
|
+
return None
|
|
68
69
|
|
|
69
70
|
current = Path(start_dir or os.getcwd()).expanduser()
|
|
70
71
|
if current.is_file():
|
|
@@ -74,12 +75,52 @@ def find_pyappify_executable(start_dir=None, environ=None):
|
|
|
74
75
|
except OSError:
|
|
75
76
|
current = current.absolute()
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if
|
|
82
|
-
|
|
78
|
+
working_directory = next(
|
|
79
|
+
(
|
|
80
|
+
directory
|
|
81
|
+
for directory in (current,) + tuple(current.parents)
|
|
82
|
+
if directory.name.casefold() == "working" and directory.parent.name
|
|
83
|
+
),
|
|
84
|
+
None,
|
|
85
|
+
)
|
|
86
|
+
if working_directory is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
app_name = working_directory.parent.name
|
|
90
|
+
apps_directory = working_directory.parent.parent
|
|
91
|
+
data_directory = apps_directory.parent
|
|
92
|
+
if apps_directory.name.casefold() != "apps" or data_directory.name.casefold() != "data":
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
app_root = data_directory.parent
|
|
96
|
+
exact_launcher_name = "{} Launcher.exe".format(app_name).casefold()
|
|
97
|
+
search_directories = []
|
|
98
|
+
directory = working_directory
|
|
99
|
+
while True:
|
|
100
|
+
search_directories.append(directory)
|
|
101
|
+
if directory == app_root:
|
|
102
|
+
break
|
|
103
|
+
directory = directory.parent
|
|
104
|
+
|
|
105
|
+
for directory in search_directories:
|
|
106
|
+
try:
|
|
107
|
+
candidates = [
|
|
108
|
+
candidate
|
|
109
|
+
for candidate in directory.iterdir()
|
|
110
|
+
if candidate.is_file()
|
|
111
|
+
and candidate.suffix.casefold() == ".exe"
|
|
112
|
+
and candidate.name.casefold().startswith(app_name.casefold())
|
|
113
|
+
]
|
|
114
|
+
except OSError:
|
|
115
|
+
continue
|
|
116
|
+
if candidates:
|
|
117
|
+
candidates.sort(
|
|
118
|
+
key=lambda candidate: (
|
|
119
|
+
candidate.name.casefold() != exact_launcher_name,
|
|
120
|
+
candidate.name.casefold(),
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
return str(candidates[0].resolve())
|
|
83
124
|
return None
|
|
84
125
|
|
|
85
126
|
|
|
@@ -291,7 +332,8 @@ def _require_pyappify_executable():
|
|
|
291
332
|
if not pyappify_executable:
|
|
292
333
|
raise FileNotFoundError(
|
|
293
334
|
"PyAppify executable was not found. Set PYAPPIFY_EXECUTABLE to an "
|
|
294
|
-
"existing executable or place
|
|
335
|
+
"existing executable or place an executable whose name starts with the app name "
|
|
336
|
+
"in the working directory or a parent directory."
|
|
295
337
|
)
|
|
296
338
|
return pyappify_executable
|
|
297
339
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|