diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-14 18:13:27 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-14 18:13:27 +0900 |
commit | d45e12f775c5ffc077fc48c90bdbdc43c699b320 (patch) | |
tree | 192a741c52a44c2242deb5d5dcb499658bc9d429 /buildstream/source.py | |
parent | 188d819dfb8447043691287985b06b8f877c5713 (diff) | |
download | buildstream-d45e12f775c5ffc077fc48c90bdbdc43c699b320.tar.gz |
source.py: Adhere to policy on private symbols
This is a part of issue #285
Diffstat (limited to 'buildstream/source.py')
-rw-r--r-- | buildstream/source.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/buildstream/source.py b/buildstream/source.py index 0373e376d..d626fea35 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -367,32 +367,18 @@ class Source(Plugin): def _fetch(self): self.fetch() - # Ensures a fully constructed path and returns it - def _ensure_directory(self, directory): - - if self.__directory is not None: - directory = os.path.join(directory, self.__directory.lstrip(os.sep)) - - try: - os.makedirs(directory, exist_ok=True) - except OSError as e: - raise SourceError("Failed to create staging directory: {}" - .format(e), - reason="ensure-stage-dir-fail") from e - return directory - # Wrapper for stage() api which gives the source # plugin a fully constructed path considering the # 'directory' option # def _stage(self, directory): - staging_directory = self._ensure_directory(directory) + staging_directory = self.__ensure_directory(directory) self.stage(staging_directory) # Wrapper for init_workspace() def _init_workspace(self, directory): - directory = self._ensure_directory(directory) + directory = self.__ensure_directory(directory) self.init_workspace(directory) @@ -584,6 +570,21 @@ class Source(Plugin): ############################################################# # Local Private Methods # ############################################################# + + # Ensures a fully constructed path and returns it + def __ensure_directory(self, directory): + + if self.__directory is not None: + directory = os.path.join(directory, self.__directory.lstrip(os.sep)) + + try: + os.makedirs(directory, exist_ok=True) + except OSError as e: + raise SourceError("Failed to create staging directory: {}" + .format(e), + reason="ensure-stage-dir-fail") from e + return directory + def __init_defaults(self): if not self.__defaults_set: project = self._get_project() |