build-scripts/build_linux_installer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
From: Nate DeSimone <nathaniel.l.desimone@intel.com>
Make path handling in build_linux_installer.py more platform agnostic
Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
build-scripts/build_linux_installer.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/build-scripts/build_linux_installer.py b/build-scripts/build_linux_installer.py
index 84ccf79..df316b9 100755
--- a/build-scripts/build_linux_installer.py
+++ b/build-scripts/build_linux_installer.py
@@ -21,7 +21,7 @@ def main():
os.environ['BUILD_NUMBER'] = args.build
# Step 1: Create required directory structure
- dist_root = os.path.abspath('../dist/self_extract')
+ dist_root = os.path.abspath('..{0}dist{0}self_extract'.format(os.sep))
if not os.path.isdir(os.path.join(dist_root, 'wheels')):
os.makedirs(os.path.join(dist_root, 'wheels'))
if not os.path.isdir(os.path.join(dist_root, 'config')):
@@ -35,7 +35,7 @@ def main():
return 1
# Step 3: Copy required files
- inst_root = os.path.abspath('../edkrepo_installer')
+ inst_root = os.path.abspath('..{0}edkrepo_installer'.format(os.sep))
ven_root = os.path.join(inst_root, 'Vendor')
linux_root = os.path.join(inst_root, 'linux-scripts')
try:
@@ -55,7 +55,7 @@ def main():
# Step 4: Package installer files
try:
- subprocess.run('./final_copy.py', check=True)
+ subprocess.run('.{0}final_copy.py'.format(os.sep), check=True)
except:
print('Failed to generate installer package')
return 1
@@ -65,7 +65,7 @@ def main():
shutil.rmtree(dist_root, ignore_errors=True)
except:
print('Failed to remove temporary files')
- os.unlink('./final_copy.py')
+ os.unlink('.{0}final_copy.py'.format(os.sep))
return 0
--
2.20.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#52578): https://edk2.groups.io/g/devel/message/52578
Mute This Topic: https://groups.io/mt/69280773/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com> -----Original Message----- From: Desimone, Nathaniel L Sent: Thursday, December 26, 2019 6:05 PM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com> Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: build_linux_installer.py path fixes From: Nate DeSimone <nathaniel.l.desimone@intel.com> Make path handling in build_linux_installer.py more platform agnostic Cc: Ashley DeSimone <ashley.e.desimone@intel.com> Cc: Puja Pandya <puja.pandya@intel.com> Cc: Erik Bjorge <erik.c.bjorge@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> --- build-scripts/build_linux_installer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-scripts/build_linux_installer.py b/build-scripts/build_linux_installer.py index 84ccf79..df316b9 100755 --- a/build-scripts/build_linux_installer.py +++ b/build-scripts/build_linux_installer.py @@ -21,7 +21,7 @@ def main(): os.environ['BUILD_NUMBER'] = args.build # Step 1: Create required directory structure - dist_root = os.path.abspath('../dist/self_extract') + dist_root = os.path.abspath('..{0}dist{0}self_extract'.format(os.sep)) if not os.path.isdir(os.path.join(dist_root, 'wheels')): os.makedirs(os.path.join(dist_root, 'wheels')) if not os.path.isdir(os.path.join(dist_root, 'config')): @@ -35,7 +35,7 @@ def main(): return 1 # Step 3: Copy required files - inst_root = os.path.abspath('../edkrepo_installer') + inst_root = os.path.abspath('..{0}edkrepo_installer'.format(os.sep)) ven_root = os.path.join(inst_root, 'Vendor') linux_root = os.path.join(inst_root, 'linux-scripts') try: @@ -55,7 +55,7 @@ def main(): # Step 4: Package installer files try: - subprocess.run('./final_copy.py', check=True) + subprocess.run('.{0}final_copy.py'.format(os.sep), check=True) except: print('Failed to generate installer package') return 1 @@ -65,7 +65,7 @@ def main(): shutil.rmtree(dist_root, ignore_errors=True) except: print('Failed to remove temporary files') - os.unlink('./final_copy.py') + os.unlink('.{0}final_copy.py'.format(os.sep)) return 0 -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52666): https://edk2.groups.io/g/devel/message/52666 Mute This Topic: https://groups.io/mt/69280773/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Nate, > From: Nate DeSimone <nathaniel.l.desimone@intel.com> > > Make path handling in build_linux_installer.py more platform agnostic > > Cc: Ashley DeSimone <ashley.e.desimone@intel.com> > Cc: Puja Pandya <puja.pandya@intel.com> > Cc: Erik Bjorge <erik.c.bjorge@intel.com> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > build-scripts/build_linux_installer.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/build-scripts/build_linux_installer.py b/build-scripts/build_linux_installer.py > index 84ccf79..df316b9 100755 > --- a/build-scripts/build_linux_installer.py > +++ b/build-scripts/build_linux_installer.py > @@ -21,7 +21,7 @@ def main(): > os.environ['BUILD_NUMBER'] = args.build > > # Step 1: Create required directory structure > - dist_root = os.path.abspath('../dist/self_extract') > + dist_root = os.path.abspath('..{0}dist{0}self_extract'.format(os.sep)) The rest of this file already use os.path.join(), can we use it instead of format(os.sep)? dist_root = os.path.abspath(os.path.join('..', 'dist', 'self_extract')) > if not os.path.isdir(os.path.join(dist_root, 'wheels')): > os.makedirs(os.path.join(dist_root, 'wheels')) > if not os.path.isdir(os.path.join(dist_root, 'config')): > @@ -35,7 +35,7 @@ def main(): > return 1 > > # Step 3: Copy required files > - inst_root = os.path.abspath('../edkrepo_installer') > + inst_root = os.path.abspath('..{0}edkrepo_installer'.format(os.sep)) inst_root = os.path.abspath(os.path.join('..', 'edkrepo_installer')) > ven_root = os.path.join(inst_root, 'Vendor') > linux_root = os.path.join(inst_root, 'linux-scripts') > try: > @@ -55,7 +55,7 @@ def main(): > > # Step 4: Package installer files > try: > - subprocess.run('./final_copy.py', check=True) > + subprocess.run('.{0}final_copy.py'.format(os.sep), check=True) Maybe we can directly simplify as: subprocess.run('final_copy.py', check=True) > except: > print('Failed to generate installer package') > return 1 > @@ -65,7 +65,7 @@ def main(): > shutil.rmtree(dist_root, ignore_errors=True) > except: > print('Failed to remove temporary files') > - os.unlink('./final_copy.py') > + os.unlink('.{0}final_copy.py'.format(os.sep)) Similarly: os.unlink('final_copy.py') > > return 0 > > -- > 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52726): https://edk2.groups.io/g/devel/message/52726 Mute This Topic: https://groups.io/mt/69280773/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Philippe, I sincerely appreciate the code review, thank you! I have addressed your feedback, please see PATCH V2. Thanks, Nate -----Original Message----- From: Philippe Mathieu-Daudé <philmd@redhat.com> Sent: Thursday, January 2, 2020 9:24 PM To: devel@edk2.groups.io; Desimone, Ashley E <ashley.e.desimone@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> Cc: Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com> Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: build_linux_installer.py path fixes Hi Nate, > From: Nate DeSimone <nathaniel.l.desimone@intel.com> > > Make path handling in build_linux_installer.py more platform agnostic > > Cc: Ashley DeSimone <ashley.e.desimone@intel.com> > Cc: Puja Pandya <puja.pandya@intel.com> > Cc: Erik Bjorge <erik.c.bjorge@intel.com> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > build-scripts/build_linux_installer.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/build-scripts/build_linux_installer.py > b/build-scripts/build_linux_installer.py > index 84ccf79..df316b9 100755 > --- a/build-scripts/build_linux_installer.py > +++ b/build-scripts/build_linux_installer.py > @@ -21,7 +21,7 @@ def main(): > os.environ['BUILD_NUMBER'] = args.build > > # Step 1: Create required directory structure > - dist_root = os.path.abspath('../dist/self_extract') > + dist_root = > + os.path.abspath('..{0}dist{0}self_extract'.format(os.sep)) The rest of this file already use os.path.join(), can we use it instead of format(os.sep)? dist_root = os.path.abspath(os.path.join('..', 'dist', 'self_extract')) > if not os.path.isdir(os.path.join(dist_root, 'wheels')): > os.makedirs(os.path.join(dist_root, 'wheels')) > if not os.path.isdir(os.path.join(dist_root, 'config')): > @@ -35,7 +35,7 @@ def main(): > return 1 > > # Step 3: Copy required files > - inst_root = os.path.abspath('../edkrepo_installer') > + inst_root = > + os.path.abspath('..{0}edkrepo_installer'.format(os.sep)) inst_root = os.path.abspath(os.path.join('..', 'edkrepo_installer')) > ven_root = os.path.join(inst_root, 'Vendor') > linux_root = os.path.join(inst_root, 'linux-scripts') > try: > @@ -55,7 +55,7 @@ def main(): > > # Step 4: Package installer files > try: > - subprocess.run('./final_copy.py', check=True) > + subprocess.run('.{0}final_copy.py'.format(os.sep), > + check=True) Maybe we can directly simplify as: subprocess.run('final_copy.py', check=True) > except: > print('Failed to generate installer package') > return 1 > @@ -65,7 +65,7 @@ def main(): > shutil.rmtree(dist_root, ignore_errors=True) > except: > print('Failed to remove temporary files') > - os.unlink('./final_copy.py') > + os.unlink('.{0}final_copy.py'.format(os.sep)) Similarly: os.unlink('final_copy.py') > > return 0 > > -- > 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53105): https://edk2.groups.io/g/devel/message/53105 Mute This Topic: https://groups.io/mt/69280773/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.