Skip to content

Commit 5b43ff0

Browse files
authored
Test to install pip on login
1 parent ece9155 commit 5b43ff0

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
lines changed

.github/workflows/on-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
python setup.py sdist bdist_wheel
5555
5656
create-deb:
57-
needs: test-enviroment-variabiles
57+
needs: pypi-install-test
5858
runs-on: ubuntu-latest
5959
steps:
6060
- uses: actions/checkout@v2

.github/workflows/on-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
asset_content_type: application/zip
123123

124124
build-for-ppa:
125-
needs: test-enviroment-variabiles
125+
needs: pypi-install-test
126126
runs-on: ubuntu-latest
127127
steps:
128128
- uses: actions/checkout@v2

choco/tools/createstructure.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ void login()
406406

407407
if (verbose)
408408
printf("%s", "Configuration saved");
409+
410+
411+
if (verbose)
412+
printf("%s", "Installing external packages");
413+
414+
system("pip3 -q install createstructure");
415+
416+
if (verbose)
417+
printf("%s", "External packages installed");
409418
}
410419

411420
void createstructure()

debian/createstructure.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#include <stdbool.h>
44
#include <string.h>
55
#include <time.h>
6-
//#include <Python.h>
7-
// gcc -std=c99 -ggdb3 -O0 -pedantic-errors -Wall -Wextra -fpie $(python3-config --cflags --embed) -o 'createstructure.out' 'createstructure.c' $(python3-config --embed --ldflags) && ./createstructure.out
86

97
// Definitions
108
#define MALLOC_MAX_SIXE 1024
@@ -126,8 +124,7 @@ char* choppy(char *s)
126124
char *n = malloc(MALLOC_MAX_SIXE); // max return size
127125
if( s )
128126
strcpy( n, s );
129-
if(n[strlen(n)-1] == "\n")
130-
n[strlen(n)-1]='\0';
127+
n[strlen(n)-1]='\0';
131128
return n;
132129
}
133130

@@ -267,10 +264,10 @@ void get_setup()
267264
puts("\u2139 Getting setup");
268265

269266
#ifdef UBUNTU
270-
TOKEN = read_by_terminal("cat ~/createstructure.conf | grep 'token' | sed 's/token=//' | sed 's/token= //'");
271-
//SOURCES = read_by_terminal("cat ~/createstructure.conf | grep 'sources' | sed 's/sources=//' | sed 's/sources= //'");
272-
ORGANIZATION_NAME = read_by_terminal("cat ~/createstructure.conf | grep 'organization_name' | sed 's/organization_name=//' | sed 's/organization_name= //'");
273-
IGNORE = read_by_terminal("cat ~/createstructure.conf | grep 'ignore' | sed 's/ignore=//' | sed 's/ignore= //'");
267+
TOKEN = read_by_terminal("cat /etc/createstructure.conf | grep 'token' | sed 's/token=//' | sed 's/token= //'");
268+
//SOURCES = read_by_terminal("cat /etc/createstructure.conf | grep 'sources' | sed 's/sources=//' | sed 's/sources= //'");
269+
ORGANIZATION_NAME = read_by_terminal("cat /etc/createstructure.conf | grep 'organization_name' | sed 's/organization_name=//' | sed 's/organization_name= //'");
270+
IGNORE = read_by_terminal("cat /etc/createstructure.conf | grep 'ignore' | sed 's/ignore=//' | sed 's/ignore= //'");
274271
#endif // UBUNTU
275272
#ifdef WINDOWS
276273
char* TO_DELATE = read_by_terminal("powershell -command \"& {echo ''}\"");
@@ -283,9 +280,6 @@ void get_setup()
283280
IGNORE = read_by_terminal("powershell -command \"& {get-content $Env:HOMEDRIVE\\Progra~1\\createstructure\\createstructure.conf | where { $_ -match 'ignore'} | %{$_ -replace 'ignore=',''} | %{$_ -replace 'ignore= ',''} }\"");
284281
IGNORE = str_replace(IGNORE, sizeof(IGNORE), TO_DELATE, "");
285282
#endif // WINDOWS
286-
TOKEN = choppy(TOKEN);
287-
ORGANIZATION_NAME = choppy(ORGANIZATION_NAME);
288-
IGNORE = choppy(IGNORE);
289283
}
290284

291285
void help(int argc, char **argv)
@@ -394,27 +388,33 @@ void login()
394388

395389
if (verbose)
396390
//printf("\n---Infos---\n\u2139 TOCKEN: %s%s\n\u2139 SOURCES: %s\n\u2139 ORGANIZATION_NAME (empty if you will use your personal account): %s\n\u2139 IGNORE: %s\n", &TEMP_TOKEN, TEMP_TOKEN_AUTO, &TEMP_SOURCES, &TEMP_ORGANIZATION_NAME, &TEMP_IGNORE);
397-
printf("\n---Infos---\n\u2139 TOCKEN: %s%s\n\u2139 ORGANIZATION_NAME (empty if you will use your personal account): %s\n\u2139 IGNORE: %s\n", choppy(&TEMP_TOKEN), choppy(TEMP_TOKEN_AUTO), choppy(&TEMP_ORGANIZATION_NAME), choppy(&TEMP_IGNORE));
391+
printf("\n---Infos---\n\u2139 TOCKEN: %s%s\n\u2139 ORGANIZATION_NAME (empty if you will use your personal account): %s\n\u2139 IGNORE: %s\n", &TEMP_TOKEN, TEMP_TOKEN_AUTO, &TEMP_ORGANIZATION_NAME, &TEMP_IGNORE);
398392

399393
// Save insert options
400394
char execution_string[2048] = {'\0'};
401395

402396
#ifdef UBUNTU
403-
//sprintf(execution_string, "sudo echo 'token=%s%s\nsources=%s\norganization_name=%s\nignore=%s' > ~/createstructure.conf", TEMP_TOKEN, TEMP_TOKEN_AUTO, TEMP_SOURCES, TEMP_ORGANIZATION_NAME, TEMP_IGNORE);
404-
sprintf(execution_string, "echo 'token=%s%s' > ~/createstructure.conf; echo 'organization_name=%s' >> ~/createstructure.conf; echo 'ignore=%s' >> ~/createstructure.conf", choppy(TEMP_TOKEN), choppy(TEMP_TOKEN_AUTO), choppy(TEMP_ORGANIZATION_NAME), choppy(TEMP_IGNORE));
405-
printf("echo 'token=%s%s' > ~/createstructure.conf; echo 'organization_name=%s' >> ~/createstructure.conf; echo 'ignore=%s' >> ~/createstructure.conf", choppy(TEMP_TOKEN), choppy(TEMP_TOKEN_AUTO), choppy(TEMP_ORGANIZATION_NAME), choppy(TEMP_IGNORE));
397+
//sprintf(execution_string, "sudo echo 'token=%s%s\nsources=%s\norganization_name=%s\nignore=%s' > /etc/createstructure.conf", TEMP_TOKEN, TEMP_TOKEN_AUTO, TEMP_SOURCES, TEMP_ORGANIZATION_NAME, TEMP_IGNORE);
398+
sprintf(execution_string, "sudo echo 'token=%s%s\norganization_name=%s\nignore=%s' > /etc/createstructure.conf", TEMP_TOKEN, TEMP_TOKEN_AUTO, TEMP_ORGANIZATION_NAME, TEMP_IGNORE);
406399
#endif // UBUNTU
407400
#ifdef WINDOWS
408401
//sprintf(execution_string, "echo token=%s%s > %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf && echo sources=%s >> %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf && echo organization_name=%s >> %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf && echo ignore=%s >> %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf", TEMP_TOKEN, TEMP_TOKEN_AUTO, TEMP_SOURCES, TEMP_ORGANIZATION_NAME, TEMP_IGNORE);
409402
sprintf(execution_string, "echo token=%s%s > %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf && echo organization_name=%s >> %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf && echo ignore=%s >> %HOMEDRIVE%\\Progra~1\\createstructure\\createstructure.conf", TEMP_TOKEN, TEMP_TOKEN_AUTO, TEMP_ORGANIZATION_NAME, TEMP_IGNORE);
410403
#endif // WINDOWS
411404

412-
if (verbose)
413-
printf("%s", execution_string);
414405
system(execution_string);
415406

416407
if (verbose)
417408
printf("%s", "Configuration saved");
409+
410+
411+
if (verbose)
412+
printf("%s", "Installing external packages");
413+
414+
system("pip3 -q install createstructure");
415+
416+
if (verbose)
417+
printf("%s", "External packages installed");
418418
}
419419

420420
void createstructure()
@@ -426,8 +426,7 @@ void createstructure()
426426
char execution_string[2048] = {'\0'};
427427
#ifdef UBUNTU
428428
//sprintf (execution_string, "python3 -c \"exec(\\\"from createstructure import createstructure;createstructure()\\\")\" -t=%s -s=%s -o=%s -i=%s %s", TOKEN, SOURCES, ORGANIZATION_NAME, IGNORE, (verbose ? "-v" : ""));
429-
//sprintf (execution_string, "python3 -c \"exec(\\\"from createstructure import createstructure;createstructure()\\\")\" -t=%s -o=%s -i=%s %s", TOKEN, ORGANIZATION_NAME, IGNORE, (verbose ? "-v" : ""));
430-
sprintf (execution_string, "python3 -c \"exec(\\\"import importlib.util;spec = importlib.util.spec_from_file_location('createstructure', '/home/castellanidavide/.local/lib/python3.8/site-packages/createstructure/__init__.py');foo = importlib.util.module_from_spec(spec);spec.loader.exec_module(foo);foo.createstructure()\\\")\" -t=%s -o=%s -i=%s %s", TOKEN, ORGANIZATION_NAME, IGNORE, (verbose ? "-v" : ""));
429+
sprintf (execution_string, "python3 -c \"exec(\\\"from createstructure import createstructure;createstructure()\\\")\" -t=%s -o=%s -i=%s %s", TOKEN, ORGANIZATION_NAME, IGNORE, (verbose ? "-v" : ""));
431430
#endif // UBUNTU
432431
#ifdef WINDOWS
433432
//sprintf (execution_string, "python.exe -c \"exec(\\\"from createstructure import createstructure;createstructure()\\\")\" -t=%s -s=%s -o=%s -i=%s %s", TOKEN, SOURCES, ORGANIZATION_NAME, IGNORE, (verbose ? "-v" : ""));

debian/debian/postinst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/bin/bash
2-
echo "Install supplementary parts"
3-
pip3 install createstructure==7.3
4-
echo "Installed createstructure"
5-
6-
echo "----------------------------------------------------------------"
7-
echo "---createstructure-remember-to-do: sudo createstructure -v -l---"
8-
echo "----------------------------------------------------------------"
2+
echo "-------------------------------------------------------------"
3+
echo "---createstructure-remember-to-do: sudo createstructure -l---"
4+
echo "-------------------------------------------------------------"

0 commit comments

Comments
 (0)