Skip to content

Commit

Permalink
Add a per-project --skip-update option
Browse files Browse the repository at this point in the history
This way I can write my JSON config file so that certain projects are only
updated if I explicitly pass --foo/no-skip-update on the command line.

This is especially useful if a git pull --rebase won't work
  • Loading branch information
arichardson committed Oct 23, 2018
1 parent 71f2497 commit 16b32f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pycheribuild/projects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,12 @@ def setupConfigOptions(cls, installDirectoryHelp="", **kwargs):
help="Override default source directory for " + cls.projectName)
cls.buildDir = cls.addPathOption("build-directory", metavar="DIR", default=cls.defaultBuildDir,
help="Override default source directory for " + cls.projectName)

cls.skipUpdate = cls.addBoolOption("skip-update",
default=ComputedDefaultValue(lambda config, proj: config.skipUpdate,
"the value of the global --skip-update option"),
help="Override --skip-update/--no-skip-update for this target only ")

if not installDirectoryHelp:
installDirectoryHelp = "Override default install directory for " + cls.projectName
cls.installDir = cls.addPathOption("install-directory", metavar="DIR", help=installDirectoryHelp,
Expand Down Expand Up @@ -967,7 +973,7 @@ def _ensureGitRepoIsCloned(self, *, srcDir: Path, remoteUrl, initialBranch=None,
def _updateGitRepo(self, srcDir: Path, remoteUrl, *, revision=None, initialBranch=None, skipSubmodules=False):
self._ensureGitRepoIsCloned(srcDir=srcDir, remoteUrl=remoteUrl, initialBranch=initialBranch,
skipSubmodules=skipSubmodules)
if self.config.skipUpdate:
if self.skipUpdate:
return
# make sure we run git stash if we discover any local changes
hasChanges = len(runCmd("git", "diff", "--stat", "--ignore-submodules",
Expand Down

0 comments on commit 16b32f8

Please sign in to comment.