Update repo bundling task.
@@ -15,6 +15,7 @@ import luigi
from law.task.base import Task
from law.target.local import LocalFileTarget
+from law.target.file import get_path
from law.parameter import CSVParameter, NO_STR
from law.decorator import log
from law.util import rel_path, interruptable_popen
@@ -24,16 +25,16 @@ class BundleGitRepository(Task):
task_namespace = "law.git"
- path = luigi.Parameter(description="the path to the repository to bundle")
- exclude = CSVParameter(default=[], description="patterns of files to exclude")
- force_include = CSVParameter(default=[], description="patterns of files to force-include, "
+ repo_path = luigi.Parameter(description="the path to the repository to bundle")
+ exclude_files = CSVParameter(default=[], description="patterns of files to exclude")
+ include_files = CSVParameter(default=[], description="patterns of files to force-include, "
"takes precedence over .gitignore")
custom_checksum = luigi.Parameter(default=NO_STR, description="a custom checksum to use")
def __init__(self, *args, **kwargs):
super(BundleGitRepository, self).__init__(*args, **kwargs)
- self.path = os.path.expandvars(os.path.expanduser(os.path.abspath(self.path)))
+ self.repo_path = os.path.expandvars(os.path.expanduser(os.path.abspath(self.repo_path)))
self._checksum = None
@property
@@ -42,7 +43,7 @@ class BundleGitRepository(Task):
return self.custom_checksum
if self._checksum is None:
- cmd = [rel_path(__file__, "repository_checksum.sh"), self.path]
+ cmd = [rel_path(__file__, "repository_checksum.sh"), self.repo_path]
code, out, _ = interruptable_popen(cmd, stdout=subprocess.PIPE)
if code != 0:
@@ -53,7 +54,7 @@ class BundleGitRepository(Task):
return self._checksum
def output(self):
- return LocalFileTarget("{}_{}.tgz".format(os.path.basename(self.path), self.checksum))
+ return LocalFileTarget("{}_{}.tgz".format(os.path.basename(self.repo_path), self.checksum))
@log
def run(self):
@@ -61,9 +62,9 @@ class BundleGitRepository(Task):
self.bundle(tmp.path)
def bundle(self, dst_path):
- cmd = [rel_path(__file__, "bundle_repository.sh"), self.path, dst_path]
- cmd += [" ".join(self.exclude)]
- cmd += [" ".join(self.force_include)]
+ cmd = [rel_path(__file__, "bundle_repository.sh"), self.repo_path, get_path(dst_path)]
+ cmd += [" ".join(self.exclude_files)]
+ cmd += [" ".join(self.include_files)]
code = interruptable_popen(cmd)[0]
if code != 0:
