Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ideascube
ARCHIVED Kiwix Hotspot
Commits
e28f9a48
Commit
e28f9a48
authored
May 02, 2017
by
thiolliere
Browse files
use pyyaml for reading catalog
it is useful for more complete app like GUI app
parent
4a04dd45
Changes
3
Hide whitespace changes
Inline
Side-by-side
pibox-installer/__main__.py
View file @
e28f9a48
...
...
@@ -3,6 +3,7 @@
import
os
import
argparse
import
sys
import
yaml
from
backend
import
vexpress_boot
from
backend
import
catalog
from
backend
import
raspbian
...
...
@@ -31,7 +32,8 @@ os.makedirs("build", exist_ok=True)
os
.
chdir
(
"build"
)
if
args
.
catalog
:
print
(
catalog
.
get_catalog
())
for
catalog
in
catalog
.
get_catalogs
():
print
(
yaml
.
dump
(
catalog
,
default_flow_style
=
False
,
default_style
=
''
))
exit
(
0
)
vexpress_boot
.
get
()
...
...
pibox-installer/backend/catalog.py
View file @
e28f9a48
import
os
import
urllib.request
import
yaml
from
.
import
pretty_print
catalog_dir
=
"catalog"
catalog_url_path
=
"http://catalog.ideascube.org/"
catalog_files
=
[
...
...
@@ -12,9 +11,10 @@ catalog_files = [
"bibliotecamovil.yml"
,
]
def
get_catalog
():
catalog
=
""
def
get_catalog
s
():
catalog
=
[]
for
catalog_file
in
catalog_files
:
with
urllib
.
request
.
urlopen
(
catalog_url_path
+
catalog_file
)
as
f
:
catalog
+=
f
.
read
().
decode
(
"utf-8"
)
catalog
.
append
(
yaml
.
load
(
f
.
read
().
decode
(
"utf-8"
)))
return
catalog
requirements.txt
View file @
e28f9a48
...
...
@@ -7,4 +7,5 @@ paramiko==2.1.2
pyasn1
==0.2.3
pycparser
==2.17
pyparsing
==2.2.0
PyYAML
==3.12
six
==1.10.0
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment