1 |
commit: 792c17dd38a38430ca75aa95f81e9f27fdcd989b |
2 |
Author: Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Aug 1 12:55:39 2013 +0000 |
4 |
Commit: Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com> |
5 |
CommitDate: Thu Aug 1 12:55:39 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=792c17dd |
7 |
|
8 |
g_sorcery/fileutils: different fixes |
9 |
|
10 |
--- |
11 |
g_sorcery/fileutils.py | 19 ++++++++++++++----- |
12 |
1 file changed, 14 insertions(+), 5 deletions(-) |
13 |
|
14 |
diff --git a/g_sorcery/fileutils.py b/g_sorcery/fileutils.py |
15 |
index ab42ff2..c7a5257 100644 |
16 |
--- a/g_sorcery/fileutils.py |
17 |
+++ b/g_sorcery/fileutils.py |
18 |
@@ -50,7 +50,8 @@ class FileJSON(object): |
19 |
for key in self.mandatories: |
20 |
content[key] = "" |
21 |
with open(self.path, 'w') as f: |
22 |
- json.dump(content, f, indent=2, sort_keys=True, cls=JSONSerializer) |
23 |
+ json.dump(content, f, indent=2, |
24 |
+ sort_keys=True, cls=JSONSerializer) |
25 |
else: |
26 |
with open(self.path, 'r') as f: |
27 |
content = json.load(f, object_hook=deserializeHook) |
28 |
@@ -120,7 +121,8 @@ def wget(uri, directory, output=""): |
29 |
Nonzero in case of a failure. |
30 |
""" |
31 |
if output: |
32 |
- ret = os.system('wget ' + uri + ' -O ' + os.path.join(directory, output)) |
33 |
+ ret = os.system('wget ' + uri + |
34 |
+ ' -O ' + os.path.join(directory, output)) |
35 |
else: |
36 |
ret = os.system('wget -P ' + directory + ' ' + uri) |
37 |
return ret |
38 |
@@ -142,6 +144,10 @@ class ManifestEntry: |
39 |
""" |
40 |
A manifest entry for a file. |
41 |
""" |
42 |
+ |
43 |
+ __slots__ = ('directory', 'name', 'ftype', 'digest', |
44 |
+ 'size', 'sha256', 'sha512', 'whirlpool') |
45 |
+ |
46 |
def __init__(self, directory, name, ftype): |
47 |
self.directory = directory |
48 |
self.name = name |
49 |
@@ -179,9 +185,11 @@ def fast_manifest(directory): |
50 |
metadata = os.path.join(directory, "metadata.xml") |
51 |
|
52 |
for aux in glob.glob(os.path.join(directory, "files/*")): |
53 |
- manifest.append(ManifestEntry(os.path.dirname(aux), os.path.basename(aux), "AUX")) |
54 |
+ manifest.append(ManifestEntry(os.path.dirname(aux), |
55 |
+ os.path.basename(aux), "AUX")) |
56 |
for ebuild in glob.glob(os.path.join(directory, "*.ebuild")): |
57 |
- manifest.append(ManifestEntry(directory, os.path.basename(ebuild), "EBUILD")) |
58 |
+ manifest.append(ManifestEntry(directory, |
59 |
+ os.path.basename(ebuild), "EBUILD")) |
60 |
if (os.path.isfile(metadata)): |
61 |
manifest.append(ManifestEntry(directory, "metadata.xml", "MISC")) |
62 |
|
63 |
@@ -249,7 +257,8 @@ def load_remote_file(uri, parser, open_file = True, open_mode='r', output=""): |
64 |
name, extention = os.path.splitext(f_name) |
65 |
if extention in [".xz", ".lzma"]: |
66 |
if (os.system("xz -d " + f_name)): |
67 |
- raise DownloadingError("xz failed: " + f_name + " from " + uri) |
68 |
+ raise DownloadingError("xz failed: " |
69 |
+ + f_name + " from " + uri) |
70 |
f_name = name |
71 |
loaded_data.update(_call_parser(f_name, parser, |
72 |
open_file=open_file, open_mode=open_mode)) |