|
12345678910111213141516171819202122232425262728293031323334353637 |
- import argparse
- import subprocess
-
-
- def deploy(*, dry_run):
- cmd = [
- "rsync",
- "--itemize-changes",
- "--recursive",
- "--delete",
- "build/html/",
- "dedi3:/srv/nginx/html/python",
- ]
- if dry_run:
- cmd.append("--dry-run")
- print(*cmd)
- subprocess.run(cmd, check=True)
-
- cmd = [
- "scp",
- "build/latex/programmationenpython.pdf",
- "dedi3:/srv/nginx/html/python/cours-python.pdf",
- ]
- print(*cmd)
- if not dry_run:
- subprocess.run(cmd, check=True)
-
-
- def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("--dry-run", action="store_true")
- args = parser.parse_args()
- deploy(dry_run=args.dry_run)
-
-
- if __name__ == "__main__":
- main()
|