[gnome-build-meta/abderrahim/bst2: 319/320] plugins/collect_initial_scripts.py: port to bst2
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/abderrahim/bst2: 319/320] plugins/collect_initial_scripts.py: port to bst2
- Date: Sat, 6 Mar 2021 11:50:02 +0000 (UTC)
commit 4500992a4544890ca74a7fd9030006edb6dcad74
Author: Abderrahim Kitouni <akitouni gnome org>
Date: Thu Jun 25 20:06:52 2020 +0100
plugins/collect_initial_scripts.py: port to bst2
plugins/collect_initial_scripts.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/plugins/collect_initial_scripts.py b/plugins/collect_initial_scripts.py
index 39090aa9..268d05be 100644
--- a/plugins/collect_initial_scripts.py
+++ b/plugins/collect_initial_scripts.py
@@ -34,8 +34,9 @@ class ExtractInitialScriptsElement(Element):
pass
def assemble(self, sandbox):
- basedir = sandbox.get_directory()
- path = os.path.join(basedir, self.path.lstrip(os.sep))
+ basedir = sandbox.get_virtual_directory()
+ path_components = self.path.strip(os.sep).split(os.sep)
+
index = 0
for dependency in self.dependencies(Scope.BUILD):
public = dependency.get_public_data('initial-script')
@@ -44,11 +45,11 @@ class ExtractInitialScriptsElement(Element):
index += 1
depname = re.sub('[^A-Za-z0-9]', '_', dependency.name)
basename = '{:03}-{}'.format(index, depname)
- filename = os.path.join(path, basename)
- os.makedirs(path, exist_ok=True)
- with open(filename, 'w') as f:
- f.write(script)
- os.chmod(filename, 0o755)
+
+ pathdir = basedir.descend(*path_components, create=True)
+ with pathdir.open_file(basename, mode='w') as f:
+ f.write(script)
+ os.chmod(f.fileno(), 0o755)
return os.sep
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]