moleditpy-installer 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.
- moleditpy_installer-0.1.0/PKG-INFO +37 -0
- moleditpy_installer-0.1.0/README.md +20 -0
- moleditpy_installer-0.1.0/moleditpy_installer/__init__.py +0 -0
- moleditpy_installer-0.1.0/moleditpy_installer/data/icon.icns +0 -0
- moleditpy_installer-0.1.0/moleditpy_installer/data/icon.ico +0 -0
- moleditpy_installer-0.1.0/moleditpy_installer/data/icon.png +0 -0
- moleditpy_installer-0.1.0/moleditpy_installer/main.py +135 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/PKG-INFO +37 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/SOURCES.txt +13 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/dependency_links.txt +1 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/entry_points.txt +2 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/requires.txt +10 -0
- moleditpy_installer-0.1.0/moleditpy_installer.egg-info/top_level.txt +1 -0
- moleditpy_installer-0.1.0/pyproject.toml +35 -0
- moleditpy_installer-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: moleditpy-installer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Installer and shortcut creator for moleditpy (OS-dependent)
|
|
5
|
+
Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: pyshortcuts>=1.0.0
|
|
14
|
+
Requires-Dist: moleditpy-linux; sys_platform == "linux"
|
|
15
|
+
Requires-Dist: moleditpy; sys_platform == "win32"
|
|
16
|
+
Requires-Dist: moleditpy; sys_platform == "darwin"
|
|
17
|
+
|
|
18
|
+
# Moleditpy Installer
|
|
19
|
+
|
|
20
|
+
This package is a helper utility that automatically installs the correct version of `moleditpy` or `moleditpy-linux` for your OS and creates an application menu shortcut.
|
|
21
|
+
|
|
22
|
+
## How to Use
|
|
23
|
+
|
|
24
|
+
1. **Install**
|
|
25
|
+
```bash
|
|
26
|
+
pip install moleditpy-installer
|
|
27
|
+
```
|
|
28
|
+
This will automatically install the correct `moleditpy` package (for Windows/macOS) or `moleditpy-linux` (for Linux) as a dependency.
|
|
29
|
+
|
|
30
|
+
2. **Create Shortcut**
|
|
31
|
+
After installation, run the following command in your terminal to create the shortcut in your application menu (e.g., Start Menu on Windows).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
moleditpy-installer
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Moleditpy Installer
|
|
2
|
+
|
|
3
|
+
This package is a helper utility that automatically installs the correct version of `moleditpy` or `moleditpy-linux` for your OS and creates an application menu shortcut.
|
|
4
|
+
|
|
5
|
+
## How to Use
|
|
6
|
+
|
|
7
|
+
1. **Install**
|
|
8
|
+
```bash
|
|
9
|
+
pip install moleditpy-installer
|
|
10
|
+
```
|
|
11
|
+
This will automatically install the correct `moleditpy` package (for Windows/macOS) or `moleditpy-linux` (for Linux) as a dependency.
|
|
12
|
+
|
|
13
|
+
2. **Create Shortcut**
|
|
14
|
+
After installation, run the following command in your terminal to create the shortcut in your application menu (e.g., Start Menu on Windows).
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
moleditpy-installer
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import platform
|
|
3
|
+
import importlib.resources # Python 3.9+
|
|
4
|
+
import os
|
|
5
|
+
from pyshortcuts import make_shortcut
|
|
6
|
+
|
|
7
|
+
if platform.system() == "Windows":
|
|
8
|
+
import winreg
|
|
9
|
+
|
|
10
|
+
def get_icon_path():
|
|
11
|
+
"""Gets the path to the correct icon file based on the OS."""
|
|
12
|
+
system = platform.system()
|
|
13
|
+
icon_name = ""
|
|
14
|
+
|
|
15
|
+
if system == "Windows":
|
|
16
|
+
icon_name = "icon.ico"
|
|
17
|
+
elif system == "Darwin": # macOS
|
|
18
|
+
icon_name = "icon.icns"
|
|
19
|
+
elif system == "Linux":
|
|
20
|
+
icon_name = "icon.png"
|
|
21
|
+
else:
|
|
22
|
+
return None # Unsupported OS
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
# --- START OF FIX ---
|
|
26
|
+
# In Python 3.12+, .files() returns a Path object directly.
|
|
27
|
+
# The 'with' statement is not needed and causes an error.
|
|
28
|
+
path = importlib.resources.files("moleditpy_installer").joinpath("data", icon_name)
|
|
29
|
+
|
|
30
|
+
if not path.exists():
|
|
31
|
+
print(f"Error: Icon file not found at expected location: {path}")
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
return str(path)
|
|
35
|
+
# --- END OF FIX ---
|
|
36
|
+
|
|
37
|
+
except Exception as e:
|
|
38
|
+
print(f"Error finding icon file {icon_name}: {e}")
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
def register_file_associations_windows(exe_path, icon_path):
|
|
42
|
+
"""Register file associations for .pmeprj and .pmeraw files on Windows."""
|
|
43
|
+
try:
|
|
44
|
+
extensions = [".pmeprj", ".pmeraw"]
|
|
45
|
+
prog_id = "MoleditPy.File"
|
|
46
|
+
app_name = "MoleditPy"
|
|
47
|
+
|
|
48
|
+
print("Registering file associations...")
|
|
49
|
+
|
|
50
|
+
# Create ProgID
|
|
51
|
+
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, f"Software\\Classes\\{prog_id}") as key:
|
|
52
|
+
winreg.SetValue(key, "", winreg.REG_SZ, f"{app_name} File")
|
|
53
|
+
|
|
54
|
+
# Set default icon
|
|
55
|
+
if icon_path and os.path.exists(icon_path):
|
|
56
|
+
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, f"Software\\Classes\\{prog_id}\\DefaultIcon") as key:
|
|
57
|
+
winreg.SetValue(key, "", winreg.REG_SZ, icon_path)
|
|
58
|
+
|
|
59
|
+
# Set open command
|
|
60
|
+
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, f"Software\\Classes\\{prog_id}\\shell\\open\\command") as key:
|
|
61
|
+
winreg.SetValue(key, "", winreg.REG_SZ, f'"{exe_path}" "%1"')
|
|
62
|
+
|
|
63
|
+
# Associate extensions
|
|
64
|
+
for ext in extensions:
|
|
65
|
+
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, f"Software\\Classes\\{ext}") as key:
|
|
66
|
+
winreg.SetValue(key, "", winreg.REG_SZ, prog_id)
|
|
67
|
+
print(f" Associated {ext} with {app_name}")
|
|
68
|
+
|
|
69
|
+
print("File associations registered successfully.")
|
|
70
|
+
return True
|
|
71
|
+
|
|
72
|
+
except Exception as e:
|
|
73
|
+
print(f"Failed to register file associations: {e}")
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
def create_shortcut():
|
|
77
|
+
"""
|
|
78
|
+
Creates a shortcut for the installed moleditpy executable.
|
|
79
|
+
"""
|
|
80
|
+
command_name = "moleditpy"
|
|
81
|
+
|
|
82
|
+
print(f"Searching for the executable '{command_name}'...")
|
|
83
|
+
exe_path = shutil.which(command_name)
|
|
84
|
+
|
|
85
|
+
if not exe_path:
|
|
86
|
+
print(f"Error: Command '{command_name}' not found.")
|
|
87
|
+
print("Please ensure 'moleditpy' or 'moleditpy-linux' is installed correctly")
|
|
88
|
+
print("and that its location is included in your system's PATH.")
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
print(f"Executable found: {exe_path}")
|
|
92
|
+
|
|
93
|
+
icon_path = get_icon_path()
|
|
94
|
+
|
|
95
|
+
if not icon_path:
|
|
96
|
+
print("Warning: Could not find a suitable icon file. A default icon will be used.")
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
shortcut_name = "MoleditPy"
|
|
100
|
+
system = platform.system()
|
|
101
|
+
|
|
102
|
+
print(f"Creating '{shortcut_name}' in the application menu...")
|
|
103
|
+
|
|
104
|
+
if system == "Windows" or system == "Linux":
|
|
105
|
+
make_shortcut(
|
|
106
|
+
script=exe_path,
|
|
107
|
+
name=shortcut_name,
|
|
108
|
+
icon=icon_path,
|
|
109
|
+
desktop=False,
|
|
110
|
+
startmenu=True
|
|
111
|
+
)
|
|
112
|
+
print(f"Successfully created '{shortcut_name}' in the application menu.")
|
|
113
|
+
|
|
114
|
+
elif system == "Darwin":
|
|
115
|
+
print("macOS detected. Creating link in /Applications folder...")
|
|
116
|
+
make_shortcut(
|
|
117
|
+
script=exe_path,
|
|
118
|
+
name=shortcut_name,
|
|
119
|
+
icon=icon_path
|
|
120
|
+
)
|
|
121
|
+
print(f"Successfully created '{shortcut_name}' in /Applications.")
|
|
122
|
+
else:
|
|
123
|
+
print(f"Shortcut creation is not supported on this OS: {system}")
|
|
124
|
+
return
|
|
125
|
+
|
|
126
|
+
except Exception as e:
|
|
127
|
+
print(f"Failed to create shortcut: {e}")
|
|
128
|
+
|
|
129
|
+
# Register file associations on Windows
|
|
130
|
+
if system == "Windows" and exe_path:
|
|
131
|
+
register_file_associations_windows(exe_path, icon_path)
|
|
132
|
+
|
|
133
|
+
if __name__ == "__main__":
|
|
134
|
+
create_shortcut()
|
|
135
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: moleditpy-installer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Installer and shortcut creator for moleditpy (OS-dependent)
|
|
5
|
+
Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: pyshortcuts>=1.0.0
|
|
14
|
+
Requires-Dist: moleditpy-linux; sys_platform == "linux"
|
|
15
|
+
Requires-Dist: moleditpy; sys_platform == "win32"
|
|
16
|
+
Requires-Dist: moleditpy; sys_platform == "darwin"
|
|
17
|
+
|
|
18
|
+
# Moleditpy Installer
|
|
19
|
+
|
|
20
|
+
This package is a helper utility that automatically installs the correct version of `moleditpy` or `moleditpy-linux` for your OS and creates an application menu shortcut.
|
|
21
|
+
|
|
22
|
+
## How to Use
|
|
23
|
+
|
|
24
|
+
1. **Install**
|
|
25
|
+
```bash
|
|
26
|
+
pip install moleditpy-installer
|
|
27
|
+
```
|
|
28
|
+
This will automatically install the correct `moleditpy` package (for Windows/macOS) or `moleditpy-linux` (for Linux) as a dependency.
|
|
29
|
+
|
|
30
|
+
2. **Create Shortcut**
|
|
31
|
+
After installation, run the following command in your terminal to create the shortcut in your application menu (e.g., Start Menu on Windows).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
moleditpy-installer
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
moleditpy_installer/__init__.py
|
|
4
|
+
moleditpy_installer/main.py
|
|
5
|
+
moleditpy_installer.egg-info/PKG-INFO
|
|
6
|
+
moleditpy_installer.egg-info/SOURCES.txt
|
|
7
|
+
moleditpy_installer.egg-info/dependency_links.txt
|
|
8
|
+
moleditpy_installer.egg-info/entry_points.txt
|
|
9
|
+
moleditpy_installer.egg-info/requires.txt
|
|
10
|
+
moleditpy_installer.egg-info/top_level.txt
|
|
11
|
+
moleditpy_installer/data/icon.icns
|
|
12
|
+
moleditpy_installer/data/icon.ico
|
|
13
|
+
moleditpy_installer/data/icon.png
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
moleditpy_installer
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "moleditpy-installer"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="HiroYokoyama", email="titech.yoko.hiro@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "Installer and shortcut creator for moleditpy (OS-dependent)"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: Apache Software License",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
dependencies = [
|
|
23
|
+
"pyshortcuts >= 1.0.0",
|
|
24
|
+
"moleditpy-linux; sys_platform == 'linux'",
|
|
25
|
+
"moleditpy; sys_platform == 'win32'",
|
|
26
|
+
"moleditpy; sys_platform == 'darwin'"
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
moleditpy-installer = "moleditpy_installer.main:create_shortcut"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
"moleditpy_installer" = ["data/*.ico", "data/*.icns", "data/*.png"]
|
|
34
|
+
|
|
35
|
+
|