|
17 | 17 | import koji |
18 | 18 | import mmdzanata |
19 | 19 | import mmdzanata.fedora |
| 20 | +import os |
20 | 21 | import subprocess |
21 | 22 | import sys |
22 | 23 |
|
@@ -101,7 +102,15 @@ def extract(ctx, upload): |
101 | 102 | ctx.parent.obj['branch']), |
102 | 103 | debug=ctx.parent.obj['debug']) |
103 | 104 |
|
104 | | - potfile = "%s.pot" % ctx.parent.obj['zanata_translation_document'] |
| 105 | + try: |
| 106 | + os.mkdir(ctx.parent.obj['branch'], mode=0o0770) |
| 107 | + except OSError: |
| 108 | + # Directory already exists |
| 109 | + pass |
| 110 | + |
| 111 | + potfile = "%s/%s.pot" % ( |
| 112 | + ctx.parent.obj['branch'], |
| 113 | + ctx.parent.obj['zanata_translation_document']) |
105 | 114 |
|
106 | 115 | with open(potfile, mode="wb") as f: |
107 | 116 | pofile.write_po(f, catalog, sort_by_file=True) |
@@ -132,15 +141,15 @@ def extract(ctx, upload): |
132 | 141 | '--project', ctx.parent.obj['zanata_project'], |
133 | 142 | '--project-type', 'gettext', |
134 | 143 | '--project-version', ctx.parent.obj['branch'], |
135 | | - '--src-dir', '.'] |
| 144 | + '--src-dir', ctx.parent.obj['branch']] |
136 | 145 | result = subprocess.run(zanata_args, capture_output=True) |
137 | 146 | if result.returncode: |
138 | 147 | print(result.stderr.decode('utf-8')) |
139 | 148 | print(result.stdout.decode('utf-8')) |
140 | 149 | sys.exit(2) |
141 | 150 |
|
142 | 151 | print("Uploaded translatable strings for %s to Zanata" % ( |
143 | | - ctx.obj['branch'])) |
| 152 | + ctx.parent.obj['branch'])) |
144 | 153 |
|
145 | 154 |
|
146 | 155 | ############################################################################## |
|
0 commit comments