annotate tasks/task_social_contract.py @ 34:68b51f51878c

presentation: update docker
author Goffi <goffi@goffi.org>
date Mon, 11 Dec 2023 01:22:23 +0100
parents e7c7327f9f25
children
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
28
e7c7327f9f25 refactoring: fix imports and names in doc following modules hierarchy refactoring
Goffi <goffi@goffi.org>
parents: 22
diff changeset
6 from libervia.backend.core.i18n import _
e7c7327f9f25 refactoring: fix imports and names in doc following modules hierarchy refactoring
Goffi <goffi@goffi.org>
parents: 22
diff changeset
7 from libervia.backend.core.log import getLogger
e7c7327f9f25 refactoring: fix imports and names in doc following modules hierarchy refactoring
Goffi <goffi@goffi.org>
parents: 22
diff changeset
8 from libervia.web.server.tasks import task
7
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):
22
5fd933e238bb massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 7
diff changeset
17 sat_path = self.config_get("sat_repos_path")
7
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"))