Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/40874 )
Change subject: scons: Delete unnecessary imports from SConstruct.
......................................................................
scons: Delete unnecessary imports from SConstruct.
Also get rid of the joinpath and splitpath aliases for os.path.join and
os.path.split. The aliases are only slightly shorter, and obscure these
extremely common python methods.
Change-Id: I0784e2d8dbaacb0690a59e9fa8c8258c1df0e6c3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40874
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M SConstruct
1 file changed, 18 insertions(+), 18 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/SConstruct b/SConstruct
index af784aa..55ca0ef 100755
--- a/SConstruct
+++ b/SConstruct
@@ -77,15 +77,13 @@
# Global Python includes
import atexit
-import collections
-import itertools
import os
import sys
from os import mkdir, environ
-from os.path import abspath, basename, dirname, expanduser, normpath
-from os.path import exists, isdir, isfile
-from os.path import join as joinpath, split as splitpath
+from os.path import abspath, dirname, expanduser
+from os.path import isdir, isfile
+from os.path import join, split
from re import match
# SCons includes
@@ -165,7 +163,7 @@
# paths made absolute and ~-expanded. Paths will be interpreted
# relative to the launch directory unless a different root is provided
def makePathListAbsolute(path_list, root=GetLaunchDir()):
- return [abspath(joinpath(root, expanduser(str(p))))
+ return [abspath(os.path.join(root, expanduser(str(p))))
for p in path_list]
# Each target must have 'build' in the interior of the path; the
@@ -203,7 +201,7 @@
Export('main')
-main.SConsignFile(joinpath(build_root, "sconsign"))
+main.SConsignFile(os.path.join(build_root, "sconsign"))
# Default duplicate option is to use hard links, but this messes up
# when you use emacs to edit a file in the target dir, as emacs moves
@@ -216,7 +214,7 @@
# tree (not specific to a particular build like X86)
#
-global_vars_file = joinpath(build_root, 'variables.global')
+global_vars_file = os.path.join(build_root, 'variables.global')
global_vars = Variables(global_vars_file, args=ARGUMENTS)
@@ -603,8 +601,8 @@
for root, dirs, files in os.walk(bdir):
if 'SConsopts' in files:
if GetOption('verbose'):
- print("Reading", joinpath(root, 'SConsopts'))
- SConscript(joinpath(root, 'SConsopts'))
+ print("Reading", os.path.join(root, 'SConsopts'))
+ SConscript(os.path.join(root, 'SConsopts'))
for cb in after_sconsopts_callbacks:
cb()
@@ -687,10 +685,10 @@
if 'SConscript' in files:
build_dir = os.path.relpath(root, ext_dir)
ext_build_dirs.append(build_dir)
- main.SConscript(joinpath(root, 'SConscript'),
- variant_dir=joinpath(build_root, build_dir))
+ main.SConscript(os.path.join(root, 'SConscript'),
+ variant_dir=os.path.join(build_root, build_dir))
-gdb_xml_dir = joinpath(ext_dir, 'gdb-xml')
+gdb_xml_dir = os.path.join(ext_dir, 'gdb-xml')
Export('gdb_xml_dir')
###################################################
@@ -742,14 +740,14 @@
# variant_dir is the tail component of build path, and is used to
# determine the build parameters (e.g., 'X86')
- (build_root, variant_dir) = splitpath(variant_path)
+ (build_root, variant_dir) = os.path.split(variant_path)
# Set env variables according to the build directory config.
sticky_vars.files = []
# Variables for $BUILD_ROOT/$VARIANT_DIR are stored in
# $BUILD_ROOT/variables/$VARIANT_DIR so you can nuke
# $BUILD_ROOT/$VARIANT_DIR without losing your variables settings.
- current_vars_file = joinpath(build_root, 'variables', variant_dir)
+ current_vars_file = os.path.join(build_root, 'variables', variant_dir)
if isfile(current_vars_file):
sticky_vars.files.append(current_vars_file)
if not GetOption('silent'):
@@ -771,10 +769,12 @@
default = GetOption('default')
opts_dir = Dir('#build_opts').abspath
if default:
- default_vars_files = [joinpath(build_root, 'variables',
default),
- joinpath(opts_dir, default)]
+ default_vars_files = [
+ os.path.join(build_root, 'variables', default),
+ os.path.join(opts_dir, default)
+ ]
else:
- default_vars_files = [joinpath(opts_dir, variant_dir)]
+ default_vars_files = [os.path.join(opts_dir, variant_dir)]
existing_files = list(filter(isfile, default_vars_files))
if existing_files:
default_vars_file = existing_files[0]
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40874
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0784e2d8dbaacb0690a59e9fa8c8258c1df0e6c3
Gerrit-Change-Number: 40874
Gerrit-PatchSet: 16
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s