Skip to content
Permalink
Browse files

Consistent indenting (4 spaces, no tabs)

  • Loading branch information...
kubat committed Nov 9, 2010
1 parent 34e57a0 commit 4316051d2972c0c7204b3712ba63886a514ea9d5
Showing with 106 additions and 104 deletions.
  1. +97 −95 SConstruct
  2. +9 −9 drqman/SConscript
@@ -38,10 +38,10 @@ def get_architecture(env,escape=False,underscore=True):
if not machine:
machine = 'unknown'
elif platform.uname()[0] == 'Darwin':
if env.get('universal_binary'):
machine = Universal_Binaries_Short_Name
if env.get('universal_binary'):
machine = Universal_Binaries_Short_Name
elif platform.architecture()[0] == '64bit':
machine = 'x86_64'
machine = 'x86_64'
return machine

def wrapper_complete_command (env,cmdlist):
@@ -57,7 +57,7 @@ def get_abspath_glob(path):
pathlist=glob.glob(path)
rlist=[]
for file in pathlist:
rlist.append(os.path.abspath(file))
rlist.append(os.path.abspath(file))
return rlist

def copy_with_clean(src_files,dest_files,dest_path,env):
@@ -68,39 +68,39 @@ def copy_with_clean(src_files,dest_files,dest_path,env):
return rlist

def get_git_commit():
try:
gitlog = subprocess.Popen(["git", "log", "--oneline", "-1"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except OSError:
commit_string = ""
else:
output = gitlog.communicate()[0]
if gitlog.returncode > 0:
commit_string = ""
print("Not a Git repository. Can't fetch commit id.")
try:
gitlog = subprocess.Popen(["git", "log", "--oneline", "-1"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except OSError:
commit_string = ""
else:
commit_string = output.split(" ")[0]
print("Current Git commit id is: "+commit_string)
return commit_string
output = gitlog.communicate()[0]
if gitlog.returncode > 0:
commit_string = ""
print("Not a Git repository. Can't fetch commit id.")
else:
commit_string = output.split(" ")[0]
print("Current Git commit id is: "+commit_string)
return commit_string

def write_git_rev(commit_id):
os.chdir("libdrqueue")
rev_file = open("git_rev.h", "w")
rev_file.write("#define REVISION \""+commit_id+"\"\n")
os.chdir("..")
rev_file.close()
os.chdir("libdrqueue")
rev_file = open("git_rev.h", "w")
rev_file.write("#define REVISION \""+commit_id+"\"\n")
os.chdir("..")
rev_file.close()

# Default to mingw on windows for now.
if sys.platform == "win32":
env_lib = Environment (ENV=os.environ, TOOLS = ['mingw'])
env_lib = Environment (ENV=os.environ, TOOLS = ['mingw'])
else:
env_lib = Environment (ENV=os.environ)
env_lib = Environment (ENV=os.environ)

# Default install path for unix systems
pathprefix = '/usr/local'

# Use the specific directory for non-unix systems.
if sys.platform == "win32":
pathprefix = 'C:\\Program Files\\drqueue'
pathprefix = 'C:\\Program Files\\drqueue'

# Configuration options
opts = Variables('scons.conf')
@@ -119,22 +119,22 @@ Help(opts.GenerateHelpText(env_lib))
write_git_rev(get_git_commit())

if not env_lib.GetOption('clean'):
conf = Configure(env_lib)
if conf.CheckCHeader('unistd.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_UNISTD_H'))
if conf.CheckCHeader('stdint.h'):
conf.env.Append(CPPDEFINES = Split('HAVE_STDINT_H'))
if conf.CheckCHeader('getopt.h'):
conf.env.Append(CPPDEFINES = Split('HAVE_GETOPT_H'))
if conf.CheckCHeader('inttypes.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_INTTYPES_H'))
if conf.CheckCHeader('pwd.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_PWD_H'))
#if not conf.CheckType('PATH_MAX'):
# conf.env.Append(CPPDEFINES = Split ('PATH_MAX=512'))
if not conf.CheckFunc('snprintf'):
conf.env.Append(CPPDEFINES = Split ('snprintf=_snprintf'))
env_lib = conf.Finish()
conf = Configure(env_lib)
if conf.CheckCHeader('unistd.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_UNISTD_H'))
if conf.CheckCHeader('stdint.h'):
conf.env.Append(CPPDEFINES = Split('HAVE_STDINT_H'))
if conf.CheckCHeader('getopt.h'):
conf.env.Append(CPPDEFINES = Split('HAVE_GETOPT_H'))
if conf.CheckCHeader('inttypes.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_INTTYPES_H'))
if conf.CheckCHeader('pwd.h'):
conf.env.Append(CPPDEFINES = Split ('HAVE_PWD_H'))
#if not conf.CheckType('PATH_MAX'):
# conf.env.Append(CPPDEFINES = Split ('PATH_MAX=512'))
if not conf.CheckFunc('snprintf'):
conf.env.Append(CPPDEFINES = Split ('snprintf=_snprintf'))
env_lib = conf.Finish()

# Installation paths
idir_prefix = os.path.normpath(os.path.join('${DESTDIR}','${PREFIX}','drqueue'))
@@ -160,62 +160,64 @@ env_lib.Append (CPPDEFINES = Split ('COMM_REPORT _GNU_SOURCE ' \

print "Platform is: ",sys.platform
if sys.platform == "linux2":
env_lib.Append (CPPDEFINES = Split ('-D__LINUX'))
env_lib.Append (CPPDEFINES = Split ('-D__LINUX'))
elif sys.platform == "darwin":
env_lib.Append (CPPDEFINES = Split ('-D__OSX'))
if env_lib.get('universal_binary'):
print "Building as an MacOS X Universal Binary"
if platform.architecture()[0] == '64bit':
universal_archs = "-arch ppc -arch i386 -arch x86_64"
else:
universal_archs = "-arch ppc -arch i386"
env_lib.Append (CCFLAGS = Split('-isysroot /Developer/SDKs/MacOSX10.4u.sdk '+universal_archs+' -mmacosx-version-min=10.4'))
env_lib.Append (LINKFLAGS = Split('-isysroot /Developer/SDKs/MacOSX10.4u.sdk '+universal_archs+' -mmacosx-version-min=10.4'))
env_lib['CC'] = '/usr/bin/gcc-4.0'
env_lib['CXX'] = '/usr/bin/g++-4.0'
env_lib.Append (CPPDEFINES = Split ('-D__OSX'))
if env_lib.get('universal_binary'):
print "Building as an MacOS X Universal Binary"
if platform.architecture()[0] == '64bit':
universal_archs = "-arch i386 -arch x86_64"
else:
universal_archs = "-arch i386"
#env_lib.Append (CCFLAGS = Split('-isysroot /Developer/SDKs/MacOSX10.4u.sdk '+universal_archs+' -mmacosx-version-min=10.4'))
#env_lib.Append (LINKFLAGS = Split('-isysroot /Developer/SDKs/MacOSX10.4u.sdk '+universal_archs+' -mmacosx-version-min=10.4'))
env_lib.Append (CCFLAGS = Split(universal_archs+' -mmacosx-version-min=10.5'))
env_lib.Append (LINKFLAGS = Split(universal_archs+' -mmacosx-version-min=10.5'))
env_lib['CC'] = '/usr/bin/gcc-4.0'
env_lib['CXX'] = '/usr/bin/g++-4.0'
elif sys.platform == "irix6":
env_lib.Append (CPPDEFINES = Split ('-D__IRIX'))
env_lib['CC'] = 'c99'
env_lib.Append (CPPDEFINES = Split ('-D__IRIX'))
env_lib['CC'] = 'c99'
elif sys.platform == "cygwin":
env_lib.Append (CPPDEFINES = Split ('-D__CYGWIN'))
os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig'
env_lib.Append (CPPDEFINES = Split ('-D__CYGWIN'))
os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig'
elif sys.platform == "win32":
# Ignore MSVC security warnings by default.
env_lib.Append (CPPDEFINES = Split ('_WIN32 _CRT_SECURE_NO_WARNINGS'))
env_lib.Append (LIBS = Split ('kernel32 ws2_32 advapi32'))
if env_lib['CC'] == "cl":
env_lib.Append (LIBS = Split ('msvcrt OLDNAMES'))
env_lib.Append (LINKFLAGS = Split('/DEFAULTLIB:MSVCRT /NODEFAULTLIB'))
# Ignore MSVC security warnings by default.
env_lib.Append (CPPDEFINES = Split ('_WIN32 _CRT_SECURE_NO_WARNINGS'))
env_lib.Append (LIBS = Split ('kernel32 ws2_32 advapi32'))
if env_lib['CC'] == "cl":
env_lib.Append (LIBS = Split ('msvcrt OLDNAMES'))
env_lib.Append (LINKFLAGS = Split('/DEFAULTLIB:MSVCRT /NODEFAULTLIB'))
elif (sys.platform == "freebsd7") or (sys.platform == "freebsd8"):
env_lib.Append (CPPDEFINES = Split ('-D__FREEBSD'))
env_lib.Append (CPPDEFINES = Split ('-D__FREEBSD'))
else:
print "Unknown platform: %s"%(sys.platform,)
exit (1)
print "Unknown platform: %s"%(sys.platform,)
exit (1)

# add additional warnings if requested
if env_lib.get('enable_warnings'):
if env_lib['CC'] == "cl":
env_lib.Append (CCFLAGS = Split('/W4'))
else:
env_lib.Append (CCFLAGS = Split('-Wall -Wextra'))
if env_lib['CC'] == "cl":
env_lib.Append (CCFLAGS = Split('/W4'))
else:
env_lib.Append (CCFLAGS = Split('-Wall -Wextra'))

# add additional debug output if requested
if env_lib.get('enable_debug'):
env_lib.Append (CPPDEFINES = Split ('_DEBUG'))
if env_lib['CC'] == "cl":
env_lib.Append (CCFLAGS = Split('/Od'))
env_lib.Append (LINKFLAGS = Split('/Debug /SUBSYSTEM:Console'))
else:
env_lib.Append (CCFLAGS = Split('-g'))
env_lib.Append (CPPDEFINES = Split ('_DEBUG'))
if env_lib['CC'] == "cl":
env_lib.Append (CCFLAGS = Split('/Od'))
env_lib.Append (LINKFLAGS = Split('/Debug /SUBSYSTEM:Console'))
else:
env_lib.Append (CCFLAGS = Split('-g'))

# Base construction environment that links with the library
env = env_lib.Clone()
env.Append (LIBS = ['drqueue'],LIBPATH = ['libdrqueue'])

if sys.platform == "win32":
# Ignore MSVC security warnings by default.
env.Append (CPPDEFINES = Split ('_WIN32 _CRT_SECURE_NO_WARNINGS'))
env.Append (LIBS = Split ('kernel32 ws2_32 advapi32'))
# Ignore MSVC security warnings by default.
env.Append (CPPDEFINES = Split ('_WIN32 _CRT_SECURE_NO_WARNINGS'))
env.Append (LIBS = Split ('kernel32 ws2_32 advapi32'))

conscripts = []

@@ -230,20 +232,20 @@ conscripts.append('libdrqueue/SConscript')
master = env.Program ('master.c')
slave = env.Program ('slave.c')
if sys.platform == 'cygwin' or sys.platform == 'win32':
main_list = [ 'master.exe', 'slave.exe' ]
main_list = [ 'master.exe', 'slave.exe' ]
else:
main_list = [ 'master', 'slave' ]
main_list = [ 'master', 'slave' ]
Default (master)
Default (slave)

#
# drqman
#
if env_lib['build_drqman']:
print "Building drqman"
conscripts.append('drqman/SConscript')
print "Building drqman"
conscripts.append('drqman/SConscript')
else:
print "Not building drqman"
print "Not building drqman"

# Build all the files.
SConscript(conscripts, exports=['env_lib','main_list'])
@@ -256,12 +258,12 @@ SConscript(conscripts, exports=['env_lib','main_list'])
# Tools
#
#if sys.platform == 'cygwin':
# cmdline_tools = [ 'jobfinfo.exe','jobinfo.exe','compinfo.exe','requeue.exe','cfgreader.exe',
# cmdline_tools = [ 'jobfinfo.exe','jobinfo.exe','compinfo.exe','requeue.exe','cfgreader.exe',
# 'cjob.exe','blockhost.exe','sendjob.exe' ]
# cpp_tools = [ 'sendjob.exe' ]
# cpp_tools = [ 'sendjob.exe' ]
#else:
cmdline_tools = [ 'jobfinfo','jobinfo','compinfo','requeue','cfgreader',
'cjob','blockhost','sendjob' ]
'cjob','blockhost','sendjob' ]
cpp_tools = [ 'sendjob' ]

ctools = {}
@@ -275,10 +277,10 @@ for tool in cmdline_tools:
install_base = idir_prefix

if sys.platform == 'cygwin' or sys.platform == 'win32':
cmdline_tools_tmp = []
for tool in cmdline_tools:
cmdline_tools_tmp.append(tool + '.exe')
cmdline_tools = cmdline_tools_tmp
cmdline_tools_tmp = []
for tool in cmdline_tools:
cmdline_tools_tmp.append(tool + '.exe')
cmdline_tools = cmdline_tools_tmp

bin_list = main_list + cmdline_tools
wrapped_bin_list = wrapper_complete_command (env,bin_list)
@@ -293,14 +295,14 @@ copy_with_clean(etc_files,etc_files,idir_prefix,env)
bin_files = glob.glob(os.path.join('bin','*'))
# remove viewcmd because it's a directory, not a file
try:
bin_files.remove('bin/viewcmd')
bin_files.remove('bin/viewcmd')
except ValueError:
print("bin/viewcmd not found.")
print("bin/viewcmd not found.")

# remove drqman wrapper if drqman wasn't built
if not env_lib['build_drqman']:
bin_files.remove('bin/drqman')
bin_files.remove('bin/drqman_win.sh')
bin_files.remove('bin/drqman')
bin_files.remove('bin/drqman_win.sh')
copy_with_clean(bin_files,bin_files,idir_prefix,env)

# install viewcmd files
@@ -311,7 +313,7 @@ copy_with_clean(bin_viewcmd_files,bin_viewcmd_files,idir_prefix,env)
doc_files = [ 'AUTHORS', 'COPYING', 'ChangeLog', 'INSTALL', 'NEWS', 'README', 'README.darwin', 'README.mentalray', 'README.python', 'README.shell_variables', 'README.windows', 'setenv' ]
n = len(doc_files)
for i in range(0, n):
env.Install(idir_doc, doc_files[i])
env.Install(idir_doc, doc_files[i])

env.Command (idir_prefix,[],[Mkdir("$TARGET"),Chmod("$TARGET",0777)])
perm_logs = env.Command (idir_logs,[],[Mkdir("$TARGET"),Chmod("$TARGET",0777)])
@@ -4,18 +4,18 @@ import os
import platform,re
import subprocess

Import('env_lib')
Import('env_lib')
Import('main_list')


drqman_c = glob.glob (os.path.join('.','*.c'))

if sys.platform == 'cygwin' or sys.platform == 'win32':
drqman_bin_name = 'drqman.exe'
main_list.append('drqman/drqman.exe')
else:
drqman_bin_name = 'drqman'
main_list.append('drqman/drqman')
drqman_c = glob.glob (os.path.join('.','*.c'))

if sys.platform == 'cygwin' or sys.platform == 'win32':
drqman_bin_name = 'drqman.exe'
main_list.append('drqman/drqman.exe')
else:
drqman_bin_name = 'drqman'
main_list.append('drqman/drqman')


env_gtkstuff = env_lib.Clone ()

0 comments on commit 4316051

Please sign in to comment.
You can’t perform that action at this time.