Skip to content

Commit 8fd7ff1

Browse files
committed
add version fetch and current version
1 parent 0b70c86 commit 8fd7ff1

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

build.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ a = Analysis(
1616
['main.py'],
1717
pathex=[],
1818
binaries=[],
19-
datas=[('icon', 'icon'), ('template', 'template')],
19+
datas=[('icon', 'icon'), ('template', 'template'), ('version.txt', 'version.txt')],
2020
hookspath=[],
2121
hooksconfig={},
2222
runtime_hooks=[],

install_pyder.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
echo "This will install the compiled local 'guh' binary to '~/.local/bin' directory."
4+
read -p "Do you want to continue? [y/n]: " choice
5+
6+
if [ "$choice" != "Y" ] && [ "$choice" != "y" ]; then
7+
echo "Installation cancelled."
8+
exit 0
9+
fi
10+
11+
echo "Installing..."
12+
echo
13+
14+
pyinstaller build.spec && echo "Successfully compiled 'pyder' binary." || echo "Failed to compile 'pyder' binary."
15+
echo
16+
17+
cp dist/Pyder ~/.local/bin/pyder && echo "Successfully placed 'pyder' in '~/.local/bin' directory." || echo "Failed to place 'pyder' in '~/.local/bin' directory."
18+
chmod +x ~/.local/bin/pyder && echo "Successfully made 'pyder' executable." || echo "Failed to make 'pyder' executable."
19+
20+
pyder version >> /dev/null && echo "Successfully installed 'pyder' binary." || echo "Failed to install 'pyder' binary."
21+
echo "Installation complete."

main.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@
33
import argparse
44
import subprocess
55
import sys
6+
import urllib.request
67

78
def argParser():
89
parser = argparse.ArgumentParser(description="")
910
subparsers = parser.add_subparsers(dest="command", help="Available commands")
1011

1112
runParser = subparsers.add_parser("run", help="Able to run commands that are available in the project's run.py")
1213
runParser.add_argument("runArgs", nargs=argparse.REMAINDER, help="Arguments to pass to run.py")
14+
15+
subparsers.add_parser("version", help="Displays current version")
1316

1417
args = parser.parse_args()
1518

1619
if args.command is None:
1720
init.start()
1821
elif args.command == "run":
1922
subprocess.run([sys.executable, "run.py", *args.runArgs])
20-
23+
elif args.command == "version":
24+
url = "https://raw.githubusercontent.com/PinpointTools/Pyder/refs/heads/main/version.txt"
25+
try:
26+
with urllib.request.urlopen(url) as response:
27+
latestVersion = response.read().decode('utf-8').strip()
28+
except Exception as e:
29+
print.error(f"Error fetching URL: {e}")
30+
return None
31+
32+
with open("version.txt", "r") as f:
33+
version = f.read().strip()
34+
print.log(f"pyder ver; {version}")
35+
36+
if version != latestVersion:
37+
print.warning(f"your pyder is out of date! ({version} != {latestVersion})")
38+
else:
39+
print.log(f"your pyder is up to date! ({version} == {latestVersion})")
2140
return args
2241

2342
if __name__ == "__main__":

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

0 commit comments

Comments
 (0)