Skip to content

Commit 4c3d8df

Browse files
Merge pull request #19 from SpaciousCoder78/development
update 3.0.0 - Run Anywhere Binaries
2 parents 2b4d254 + 1f791d4 commit 4c3d8df

File tree

5 files changed

+38
-23
lines changed

5 files changed

+38
-23
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
test.py
2-
bin
2+
bin
3+
build
4+
dist
5+
search.spec

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@
44
QuickOverflow: main.c
55
pip3 install -r requirements.txt --break-system-packages
66
mkdir -p bin
7-
gcc -I/usr/include/python3.12 main.c -lpython3.12 -o bin/QuickOverflow
7+
sudo gcc main.c -o /usr/local/bin/QuickOverflow
88
chmod +x search.py
9+
pyinstaller search.py --onefile
10+
sudo mv "dist/search" "/usr/local/bin"
911

12+
arch_linux: main.c
13+
sudo pacman -S gcc
14+
sudo gcc main.c -o /usr/local/bin/QuickOverflow
15+
chmod +x search.py
16+
sudo pacman -S python-pipenv
17+
sudo pacman -S pyenv
18+
pipenv install --python 3.13
19+
pipenv shell
20+
pip3 install -r requirements.txt
21+
pyinstaller search.py --onefile
22+
sudo mv "dist/search" "/usr/local/bin"
1023

1124
#to remove the binaries, use this
1225
uninstall:

Pipfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
pyoverflow3 = "*"
8+
9+
[dev-packages]
10+
11+
[requires]
12+
python_version = "3.13"

headers/commands.h

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
****************************************************/
1212

1313

14-
//including python header for calling python scripts
15-
#include <Python.h>
14+
1615

1716
#ifndef COMMANDS_H
1817
#define COMMANDS_H
@@ -75,22 +74,9 @@ int quickoverflow_cd(char **args)
7574
int quickoverflow_search(char **args)
7675
{
7776

78-
int argc = 0;
79-
while (args[argc] != NULL) {
80-
argc++;
81-
}
82-
83-
// Initialize the Python interpreter.
84-
Py_Initialize();
85-
FILE *fp = fopen("search.py", "r");
86-
if (fp == NULL) {
87-
perror("QuickOverFlowFileNotFoundError: Have you deleted search.py by any chance?");
88-
return 1;
89-
}
90-
PyRun_SimpleFile(fp, "search.py");
91-
fclose(fp);
92-
93-
//Update 2.0.0 removed Py_Finalise to avoid segmentation faults
77+
//Update 3.0.0 - Removed Python API and enabled directly calling from anywhere in the OS
78+
//Now uses PyInstaller to generate Python Executable to run anywhere
79+
system("search");
9480

9581
return 1;
9682
}
@@ -109,7 +95,7 @@ int quickoverflow_help(char **args){
10995
"\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
11096
" \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
11197
" \n");
112-
printf("---------------------------------Version 2.1.0----------------------------\n");
98+
printf("---------------------------------Version 3.0.0----------------------------\n");
11399
printf("Type program names and arguments, and hit enter.\n");
114100
printf("The following are built in:\n");
115101

@@ -137,7 +123,7 @@ int quickoverflow_about(char **args){
137123
"\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
138124
" \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
139125
" \n");
140-
printf("Version: 2.1.0\n");
126+
printf("Version: 3.0.0\n");
141127
printf("License: GNU GPL-3 License\n");
142128
printf("Author: Aryan Karamtoth (SpaciousCoder78)\n");
143129
printf("Author Email: [email protected]\n");

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
pyoverflow3
1+
pyoverflow3
2+
pyinstaller

0 commit comments

Comments
 (0)