From 47226055babecd16872e839854258f96fc62fdbb Mon Sep 17 00:00:00 2001 From: Pavel Kirilin <win10@list.ru> Date: Tue, 6 Oct 2020 02:15:52 +0400 Subject: [PATCH] Added windows support. Signed-off-by: Pavel Kirilin <win10@list.ru> --- hooks/post_gen_project.py | 9 ++++++++- {{cookiecutter.project_name}}/first_run.bat | 6 ++++++ .../{{ cookiecutter.project_name }}_service.service | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 {{cookiecutter.project_name}}/first_run.bat diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 53ba48d..9bfbf59 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -2,10 +2,12 @@ import os import shutil import subprocess +import sys import yaml MANIFEST = "conditional_files.yaml" +FIRST_RUN_WIN = "first_run.bat" FIRST_RUN = "first_run.sh" @@ -31,8 +33,13 @@ def delete_resources_for_disabled_features(): def init_repo(): - subprocess.run(['sh', FIRST_RUN]) + if sys.platform == 'win32': + subprocess.run([FIRST_RUN_WIN]) + return + else: + subprocess.run(['sh', FIRST_RUN]) delete_resource(FIRST_RUN) + delete_resource(FIRST_RUN_WIN) subprocess.run(['git', 'add', '.']) diff --git a/{{cookiecutter.project_name}}/first_run.bat b/{{cookiecutter.project_name}}/first_run.bat new file mode 100644 index 0000000..713bd24 --- /dev/null +++ b/{{cookiecutter.project_name}}/first_run.bat @@ -0,0 +1,6 @@ +pip install --user pre-commit +git init +git add . +pre-commit install +pre-commit run -a +git add . \ No newline at end of file diff --git a/{{cookiecutter.project_name}}/systemd/{{ cookiecutter.project_name }}_service.service b/{{cookiecutter.project_name}}/systemd/{{ cookiecutter.project_name }}_service.service index 9f74760..9b624ec 100644 --- a/{{cookiecutter.project_name}}/systemd/{{ cookiecutter.project_name }}_service.service +++ b/{{cookiecutter.project_name}}/systemd/{{ cookiecutter.project_name }}_service.service @@ -1,5 +1,5 @@ [Unit] -Description=Saver service used as smart LUNAv4 proxy. +Description={{cookiecutter.project_description}} After=network.target [Service] -- GitLab