Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Add (yapi_new.py): this commit introduce the new standard and rewrite…
Browse files Browse the repository at this point in the history
… of yapi core, not much add. see issues #105 and #52
  • Loading branch information
Wabri committed Mar 30, 2019
1 parent 0f95546 commit 90db0f0
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ To install one of the packages:
To recreate the cache:

yapi cache

<!--readme_update end help -->

****
Expand Down
4 changes: 2 additions & 2 deletions config/config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[COMMON]
yapi_dir =
yapi_dir = ~/git/YAPI
platform =
file_extension = .sh
language = en
Expand All @@ -17,7 +17,7 @@ branch = master
zip = ${REMOTE:origin_location}/archive/${REMOTE:branch}.zip

[PACKAGES]
packages_path = ${COMMON:yapi_dir}/scripts
packages_path = ${COMMON:yapi_dir}/packages
ignore = test.sh, updateYapiScripts.sh
installed =

Expand Down
18 changes: 18 additions & 0 deletions packages/test.yp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[DEFAULT]
name = test
description = Description of package
url = https://github.com/YetAnotherPackageInstaller/YAPI
class = ignore

[Common]
dekstop_entry = ignore
installed = ignore
cache = ignore

[Script]
download = echo "Download section test"
before_install = echo "Before install section test"
install = echo "Install section test"
after_install = echo "After install section test"
unistall = echo "Unistall section test"
desktop_entry = echo "Desktop_entry section test"
18 changes: 18 additions & 0 deletions packages/testnotignore.yp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[DEFAULT]
name = testnotignore
description = Description of package
url = https://github.com/YetAnotherPackageInstaller/YAPI
class = testnotignore

[Common]
dekstop_entry = ignore
installed = ignore
cache = ignore

[Script]
download = echo "Download section test"
before_install = echo "Before install section test"
install = echo "Install section test"
after_install = echo "After install section test"
unistall = echo "Unistall section test"
desktop_entry = echo "Desktop_entry section test"
18 changes: 18 additions & 0 deletions packages/testnotignore2.yp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[DEFAULT]
name = tpatataest
description = Description of package
url = https://github.com/YetAnotherPackageInstaller/YAPI
class = isdasdadsgnore

[Common]
dekstop_entry = ignore
installed = ignore
cache = ignore

[Script]
download = echo "Download section test"
before_install = echo "Before install section test"
install = echo "Install section test"
after_install = echo "After install section test"
unistall = echo "Unistall section test"
desktop_entry = echo "Desktop_entry section test"
28 changes: 28 additions & 0 deletions yapi_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import subprocess
import glob
from configparser import ConfigParser
from modules.configuration.config_extractor import get_configuration
import os

config = get_configuration()
yapi_script = ConfigParser()
list_script = list()
directory = (str)(config["PACKAGES"]["packages_path"])
os.chdir(directory)
for file in glob.glob("*"+".yp"):
yapi_script.read(file)
if yapi_script["DEFAULT"]["class"] != "ignore":
list_script.append((str)(file))
print("{} - {}".format(len(list_script),
yapi_script["DEFAULT"]["name"]))
else:
print("File {} ignore!".format(yapi_script["DEFAULT"]["name"]))
print(list_script)
choose = input("Put number here -> ")
yapi_script.read(list_script[(int)(choose)-1])
output = subprocess.call(
yapi_script["Script"]["install"], shell=True, stderr=subprocess.STDOUT)
if output == 0:
print("ok")
else:
print("not ok")

0 comments on commit 90db0f0

Please sign in to comment.