annotate tasks/task_social_contract.py @ 17:6371bdc0e711

i18n: update French catalog
author Goffi <goffi@goffi.org>
date Wed, 16 Jun 2021 19:22:26 +0200
parents b5fc67c97c50
children 5fd933e238bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/ur/bin/env python2
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 import glob
7
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
4 import os.path
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 import markdown
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 from sat.core.i18n import _
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 from sat.core.log import getLogger
7
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
8 from libervia.server.tasks import task
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
9
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
10
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 log = getLogger(__name__)
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
7
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
14 class Task(task.Task):
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15
7
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
16 def start(self):
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
17 sat_path = self.getConfig("sat_repos_path")
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
18 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")):
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
19 filename = os.path.basename(filepath)
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
20 with open(filepath) as f:
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
21 md = markdown.markdown(f.read())
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
22 build_path = os.path.join(self.build_path, filename + '.html')
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
23 with open(build_path, 'w') as f:
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
24 f.write(md)
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
25
b5fc67c97c50 tasks: updated tasks following changes in Libervia
Goffi <goffi@goffi.org>
parents: 6
diff changeset
26 log.info(_("social contract has been converted to HTML"))