Skip to content

Commit 1e50421

Browse files
feat: now runs globally
1 parent d69eec0 commit 1e50421

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +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

1012
arch_linux: main.c
1113
sudo pacman -S gcc
12-
sudo pacman -S fakeroot
13-
sudo pacman -S yay
14+
sudo gcc main.c -o /usr/local/bin/QuickOverflow
15+
chmod +x search.py
1416
sudo pacman -S python-pipenv
15-
pipenv install --python 3.12
17+
sudo pacman -S pyenv
18+
pipenv install --python 3.13
1619
pipenv shell
1720
pip3 install -r requirements.txt
18-
mkdir -p bin
19-
gcc -I/usr/include/python3.12 main.c -lpython3.12 -o bin/QuickOverflow
20-
chmod +x search.py
21+
pyinstaller search.py --onefile
22+
sudo mv "dist/search" "/usr/local/bin"
2123

2224
#to remove the binaries, use this
2325
uninstall:

headers/commands.h

Lines changed: 4 additions & 18 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
}

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)