Skip to content

Commit

Permalink
Needed to indent python function documentation.
Browse files Browse the repository at this point in the history
Added the text #!/bin/sh for systempkg binary test. Changed the parameters
for kill and w command from procps-ng
  • Loading branch information
shahzebsiddiqui committed May 1, 2017
1 parent e784b56 commit de9ad48
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 61 deletions.
56 changes: 28 additions & 28 deletions modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
import sys

def get_module_list(moduletree):
"""
returns a complete list of modules found in module tree
"""
"""
returns a complete list of modules found in module tree
"""
find_cmd_module=os.popen("find " + moduletree + " -type f """).read()
modulelist=find_cmd_module.rstrip().split('\n')
return modulelist

def get_unique_software(moduletree):
"""
returns a set of software packages found in the module tree
"""
"""
returns a set of software packages found in the module tree
"""
modulelist=get_module_list(moduletree)
module_set=set()
for module in modulelist:
Expand All @@ -46,10 +46,10 @@ def get_unique_software(moduletree):
return sorted(module_set)

def get_unique_software_version(moduletree):
"""
returns a set of software-version collection found in module files. Duplicates are
ignored for instance, same package version is built with two different toolchains
"""
"""
returns a set of software-version collection found in module files. Duplicates are
ignored for instance, same package version is built with two different toolchains
"""
modulelist=get_module_list(moduletree)
moduleversion_set=set()
for module in modulelist:
Expand All @@ -71,10 +71,10 @@ def get_unique_software_version(moduletree):
return sorted(moduleversion_set)

def module_version_relation(moduletree):
"""
relationship between software name and version. The function will return a
dictionary with key values as software name and values will be a set of version
"""
"""
relationship between software name and version. The function will return a
dictionary with key values as software name and values will be a set of version
"""
modulelist=get_module_list(moduletree)
module_set=get_unique_software(moduletree)
# dictionary used for keeping a relationship between software name and its corresponding versions found as modulefiles
Expand All @@ -98,9 +98,9 @@ def module_version_relation(moduletree):
return module_dict

def get_toolchain(easyconfigdir):
"""
return the set of toolchains found in the easyconfig directory
"""
"""
return the set of toolchains found in the easyconfig directory
"""
easyconfigfiles=os.popen("find " + easyconfigdir + " -name *.eb -type f ").read().rstrip().split("\n")

# only care about unique toolchains
Expand All @@ -116,10 +116,10 @@ def get_toolchain(easyconfigdir):
return toolchain

def software_exists(software):
"""
checks whether software exist, there must be a module file present with the
same name specified as the argument.
"""
"""
checks whether software exist, there must be a module file present with the
same name specified as the argument.
"""
if len(software) != 2:
print "Too many arguments, -s takes argument <software>,<version>"
sys.exit(1)
Expand All @@ -131,9 +131,9 @@ def software_exists(software):
sys.exit(1)

def toolchain_exists(software,toolchain):
"""
checks to see if toolchain passed on command line exist in toolchain list
"""
"""
checks to see if toolchain passed on command line exist in toolchain list
"""
toolchain_list=get_toolchain(BUILDTEST_EASYCONFIGDIR)

# if toolchain is installed as hidden file then strip the "." prior to checking in list
Expand All @@ -153,10 +153,10 @@ def toolchain_exists(software,toolchain):
sys.exit(1)

def check_software_version_in_easyconfig(moduletree,software,toolchain):
"""
return True if name,version+versionsuffix,toolchain from command line is found
from easyconfig, False otherwise
"""
"""
return True if name,version+versionsuffix,toolchain from command line is found
from easyconfig, False otherwise
"""
appname=software[0]
appversion=software[1]
tcname=toolchain[0]
Expand Down
6 changes: 3 additions & 3 deletions parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
}

def parse_config(software,toolchain,filename,codedir):
"""
read config file and verify the key-value content with dictionary field
"""
"""
read config file and verify the key-value content with dictionary field
"""
fd=open(filename,'r')
content=yaml.load(fd)
# iterate over dictionary to seek any invalid keys
Expand Down
4 changes: 2 additions & 2 deletions source/system/procps-ng/command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ binaries:
pmap: -V
ps: -V
pwdx: -V
kill: -l SIGTERM
kill: -l
slabtop: -V
nice: --version
tload: -V
top: -v
uptime:
vmstat: -V
w: -v
w: -V
watch: -v
sysctl: -V
31 changes: 16 additions & 15 deletions testgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ def systempkg_process_binary_file(filename,pkg,verbose):
testname=key+".sh"
testpath=os.path.join(test_destdir,testname)
fd=open(testpath,'w')
fd.write("#!/bin/sh \n")
fd.write("module purge \n" )
# if paramter is specified then write both executable and parameter to file otherwise only write the executable
if binarydict[key]:
Expand Down Expand Up @@ -538,28 +539,28 @@ def process_binary_file(filename,software,toolchain,verbose):
print "Creating Test:", testpath

def create_dir(dirname,verbose):
"""
Create directory if it doesn't exist
"""
"""
Create directory if it doesn't exist
"""
if not os.path.isdir(dirname):
os.mkdir(dirname)
if verbose >= 1:
print "Creating Directory: ",dirname

def create_file(filename,verbose):
"""
Create an empty file if it doesn't exist
"""
"""
Create an empty file if it doesn't exist
"""
if not os.path.isfile(filename):
fd=open(filename,'w')
fd.close()
if verbose >= 1:
print "Creating Empty File:", filename

def update_CMakeLists(filename,tag, verbose):
"""
used for writing CMakeLists.txt with tag <software>, <version>, & toolchain
"""
"""
used for writing CMakeLists.txt with tag <software>, <version>, & toolchain
"""
fd=open(filename,'r')
content=fd.read().strip().split("\n")
cmd="add_subdirectory("+tag+")"
Expand All @@ -574,9 +575,9 @@ def update_CMakeLists(filename,tag, verbose):
fd.close()

def init_CMakeList(filename):
"""
This is the content of BUILDTEST_ROOT/CMakeLists.txt
"""
"""
This is the content of BUILDTEST_ROOT/CMakeLists.txt
"""
header = """
cmake_minimum_required(VERSION 2.8)
include(CTest)
Expand All @@ -587,9 +588,9 @@ def init_CMakeList(filename):
fd.close()

def load_modules(software,toolchain):
"""
return a string that loads the software and toolchain module.
"""
"""
return a string that loads the software and toolchain module.
"""
# for dummy toolchain you can load software directly. Ensure a clean environment by running module purge
if toolchain[0] == "dummy":
header="""
Expand Down
26 changes: 13 additions & 13 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import os

def isHiddenFile(inputfile):
"""
creates a relationship between software-version to a toolchain. This will show
how a module file relates to a particular toolchain
"""
"""
creates a relationship between software-version to a toolchain. This will show
how a module file relates to a particular toolchain
"""
if os.path.isdir(inputfile) == True:
return False

Expand All @@ -39,23 +39,23 @@ def isHiddenFile(inputfile):
return False

def stripHiddenFile(file):
"""
removes the leading "." character from file
"""
"""
removes the leading "." character from file
"""
file=file[1:]
return file

def print_dictionary(dictionary):
"""
prints the content of dictionary
"""
"""
prints the content of dictionary
"""
for key in dictionary:
print key, sset(dictionary[key])

def print_set(setcollection):
"""
prints the content of set
"""
"""
prints the content of set
"""
for item in setcollection:
print item
class sset(set):
Expand Down

0 comments on commit de9ad48

Please sign in to comment.