-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_script.py
More file actions
193 lines (160 loc) · 6 KB
/
Copy pathsetup_script.py
File metadata and controls
193 lines (160 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/usr/bin/env python3
"""
Setup script for Professional Cryptocurrency Wallet
Automatically installs dependencies and sets up the wallet
"""
import subprocess
import sys
import os
from pathlib import Path
def check_python_version():
"""Check if Python version is compatible"""
if sys.version_info < (3, 8):
print("❌ Error: Python 3.8 or higher is required")
print(f" Current version: {sys.version}")
print(" Please upgrade Python and try again")
return False
print(f"✅ Python version: {sys.version.split()[0]}")
return True
def install_requirements():
"""Install required packages"""
print("\n📦 Installing dependencies...")
requirements = [
"web3==6.15.1",
"eth-account==0.10.0",
"eth-utils==2.3.1",
"cryptography==41.0.7",
"ecdsa==0.18.0",
"mnemonic==0.21",
"requests==2.31.0",
"qrcode[pil]==7.4.2",
"Pillow==10.1.0"
]
for package in requirements:
try:
print(f" Installing {package}...")
subprocess.check_call([
sys.executable, "-m", "pip", "install", package
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f" ✅ {package} installed successfully")
except subprocess.CalledProcessError:
print(f" ❌ Failed to install {package}")
return False
return True
def verify_installation():
"""Verify that all required modules can be imported"""
print("\n🔍 Verifying installation...")
required_modules = [
"tkinter",
"web3",
"eth_account",
"cryptography",
"ecdsa",
"mnemonic",
"requests",
"qrcode",
"PIL"
]
failed_imports = []
for module in required_modules:
try:
__import__(module)
print(f" ✅ {module}")
except ImportError:
print(f" ❌ {module}")
failed_imports.append(module)
if failed_imports:
print(f"\n❌ Failed to import: {', '.join(failed_imports)}")
if "tkinter" in failed_imports:
print(" Note: tkinter is usually included with Python")
print(" On Ubuntu/Debian: sudo apt-get install python3-tk")
print(" On macOS: brew install python-tk")
return False
return True
def create_desktop_shortcut():
"""Create desktop shortcut (Windows/Linux)"""
try:
wallet_path = Path(__file__).parent / "crypto_wallet.py"
if sys.platform == "win32":
# Windows shortcut
import winshell
from win32com.client import Dispatch
desktop = winshell.desktop()
shortcut_path = os.path.join(desktop, "Crypto Wallet.lnk")
shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(shortcut_path)
shortcut.Targetpath = sys.executable
shortcut.Arguments = f'"{wallet_path}"'
shortcut.WorkingDirectory = str(wallet_path.parent)
shortcut.IconLocation = sys.executable
shortcut.save()
print(f" ✅ Desktop shortcut created: {shortcut_path}")
elif sys.platform.startswith("linux"):
# Linux desktop file
desktop_file = f"""[Desktop Entry]
Name=Crypto Wallet
Comment=Professional Cryptocurrency Wallet
Exec={sys.executable} "{wallet_path}"
Icon=applications-internet
Terminal=false
Type=Application
Categories=Office;Finance;
"""
desktop_path = Path.home() / "Desktop" / "Crypto-Wallet.desktop"
with open(desktop_path, 'w') as f:
f.write(desktop_file)
# Make executable
os.chmod(desktop_path, 0o755)
print(f" ✅ Desktop shortcut created: {desktop_path}")
else:
print(" ℹ️ Desktop shortcut not supported on this platform")
except ImportError:
print(" ℹ️ Could not create desktop shortcut (missing dependencies)")
except Exception as e:
print(f" ⚠️ Could not create desktop shortcut: {e}")
def main():
"""Main setup function"""
print("🚀 Professional Cryptocurrency Wallet Setup")
print("=" * 50)
# Check Python version
if not check_python_version():
input("\nPress Enter to exit...")
return
# Install requirements
if not install_requirements():
print("\n❌ Installation failed!")
input("Press Enter to exit...")
return
# Verify installation
if not verify_installation():
print("\n❌ Verification failed!")
input("Press Enter to exit...")
return
# Create desktop shortcut
print("\n🔗 Creating desktop shortcut...")
create_desktop_shortcut()
print("\n🎉 Setup completed successfully!")
print("\nYou can now run the wallet by:")
print(" 1. Double-clicking the desktop shortcut (if created)")
print(" 2. Running: python crypto_wallet.py")
print(" 3. Running: python -m crypto_wallet")
# Ask if user wants to launch the wallet
launch = input("\nWould you like to launch the wallet now? (y/n): ").lower().strip()
if launch in ['y', 'yes']:
print("\n🚀 Launching Crypto Wallet...")
try:
wallet_path = Path(__file__).parent / "crypto_wallet.py"
subprocess.Popen([sys.executable, str(wallet_path)])
print("✅ Wallet launched successfully!")
except Exception as e:
print(f"❌ Failed to launch wallet: {e}")
print("Please run manually: python crypto_wallet.py")
input("\nPress Enter to exit...")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\n⚠️ Setup cancelled by user")
except Exception as e:
print(f"\n❌ Setup failed with error: {e}")
input("Press Enter to exit...")