Skip to content

Commit

Permalink
refactor projectpaths class
Browse files Browse the repository at this point in the history
  • Loading branch information
jteijema committed Dec 13, 2024
1 parent bb44a7b commit acbe441
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions asreviewcontrib/makita/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _setup_project_folder(self):
paths = ProjectPaths(
project_folder=project_folder,
job_file=self.args.job_file,
platform=self.args.platform
platform=self.args.platform,
)

paths.output_folder_path.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -333,6 +333,15 @@ class ProjectPaths:
job_file: str = None
platform: str = None

def __post_init__(self):
if self.job_file is None:
if self.platform == "Windows" or (
self.platform is None and os.name == "nt"
):
self.job_file = "jobs.bat"
else:
self.job_file = "jobs.sh"

@property
def output_folder_path(self):
return self.project_folder / self.output_folder
Expand All @@ -347,12 +356,4 @@ def scripts_folder_path(self):

@property
def job_file_path(self):
return self.project_folder / (self.job_file or self._get_job_file_name())

def _get_job_file_name(self):
"""Determine the job file name based on the platform."""
if self.platform == "Windows" or (
self.platform is None and os.name == "nt"
):
return "jobs.bat"
return "jobs.sh"
return self.project_folder / self.job_file

0 comments on commit acbe441

Please sign in to comment.