changeset 6dcce2fca9a7 in cookiecutter:default
details: https://hg.tryton.org/cookiecutter?cmd=changeset&node=6dcce2fca9a7
description:
Do not fail on missing privilege to create symlink
If OS does not support symlink or user does not have the privilege to
create
symlink, we copy the doc index as README.
diffstat:
hooks/post_gen_project.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (14 lines):
diff -r 70a7ce11333a -r 6dcce2fca9a7 hooks/post_gen_project.py
--- a/hooks/post_gen_project.py Wed Feb 16 15:11:57 2022 +0100
+++ b/hooks/post_gen_project.py Mon Mar 14 17:22:13 2022 +0100
@@ -1,5 +1,8 @@
import os
+import shutil
+
try:
+ raise OSError()
os.symlink('doc/index.rst', 'README.rst')
-except AttributeError:
- pass
+except (AttributeError, OSError):
+ shutil.copyfile('doc/index.rst', 'README.rst')