Skip to content

Commit

Permalink
add os compatibility option
Browse files Browse the repository at this point in the history
  • Loading branch information
endremborza committed Jun 19, 2023
1 parent b238084 commit e4a823a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion branthebuilder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Python package management"""
from .main import app # noqa

__version__ = "1.0.10"
__version__ = "1.0.11"
16 changes: 12 additions & 4 deletions branthebuilder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

app = typer.Typer()

osc_path = Path(".github", "workflows", "compatibility_test.yml")
ghw_path = osc_path.parent.parent


class SetupException(Exception):
pass
Expand All @@ -40,10 +43,11 @@ def init(
actions: bool = False,
single_file: bool = False,
git: bool = True,
os_compatibility: bool = False,
):
res_dir = cookiecutter(cc_repo, no_input=not input)
os.chdir(res_dir)
_cleanup(docs, actions, notebooks, single_file)
_cleanup(docs, actions, notebooks, single_file, os_compatibility)
if not git:
return
for cmd in [
Expand Down Expand Up @@ -92,7 +96,9 @@ def update_boilerplate(merge: bool = False):
)

single = conf.module_path.endswith(".py")
_cleanup(DOC_DIR.exists(), Path(".github").exists(), nb_dir.exists(), single)
_cleanup(
DOC_DIR.exists(), ghw_path.exists(), nb_dir.exists(), single, osc_path.exists()
)
adds = check_output(["git", "add", "*"]).strip()
if adds:
check_call(["git", "commit", "-m", "update-boilerplate"])
Expand Down Expand Up @@ -202,12 +208,14 @@ def _get_branch():
return check_output(comm).strip().decode("utf-8")


def _cleanup(leave_docs, leave_actions, leave_notebooks, single_file):
def _cleanup(leave_docs, leave_actions, leave_notebooks, single_file, os_compatibility):
if not leave_docs:
rmtree(DOC_DIR)
Path(".readthedocs.yml").unlink()
if not leave_actions:
rmtree(".github")
rmtree(ghw_path)
elif not os_compatibility:
osc_path.unlink()
if not leave_notebooks:
rmtree(nb_dir)
if single_file:
Expand Down

0 comments on commit e4a823a

Please sign in to comment.