2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-27 14:51:10 +00:00

Remove trailing spaces in file create_man_pages.py

This commit is contained in:
GONG Jie
2017-12-31 23:59:59 +00:00
parent c440886cf5
commit 5763b084b1

View File

@@ -20,15 +20,15 @@ parser.add_option("--prefix", dest="PREFIX", help="Specify the location of the P
POD2RST="pod2rst"
def cmd_exists(cmd):
return subprocess.call("type " + cmd, shell=True,
return subprocess.call("type " + cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
prefix_path = None
prefix_lib_path = None
if options.PREFIX:
if options.PREFIX:
if '~' in options.PREFIX:
# else assume full path is provided
# else assume full path is provided
prefix_path = os.path.expanduser(options.PREFIX)
else:
prefix_path = options.PREFIX
@@ -39,13 +39,13 @@ if options.PREFIX:
sys.exit(1)
prefix_lib_path = "%s/lib" %(prefix_path)
if not os.path.isdir(prefix_lib_path):
if not os.path.isdir(prefix_lib_path):
prefix_lib_path = "%s/lib64" %(prefix_path)
if not os.path.isdir(prefix_lib_path):
print "ERROR, Cannot find the Perl lib directory in %s/lib or %s/lib64" %(prefix_path, prefix_path)
sys.exit(1)
else:
else:
if not cmd_exists(POD2RST):
print "ERROR, %s requires pod2rst to continue!" %(os.path.basename(__file__))
parser.print_help()
@@ -57,13 +57,13 @@ MANPAGE_DEST="./docs/source/guides/admin-guides/references/man"
#
# add the following to delete the generate files before creating them
# essentially this allows us to remove man pages and they will be
# essentially this allows us to remove man pages and they will be
# removed in the generation
print "Cleaning up the generated man pages in %s" %(MANPAGE_DEST)
allfiles = glob("%s*/*.rst" %(MANPAGE_DEST))
for d in allfiles:
# Skip over the index.rst file
if not "index.rst" in d:
for d in allfiles:
# Skip over the index.rst file
if not "index.rst" in d:
print "Removing file %s" %(d)
os.remove(d)
@@ -93,18 +93,18 @@ def fix_double_dash(rst_file):
os.system(sed_cmd)
#remove intermediate .sed1 file
rm_sed1file_cmd = "rm %s.sed1" %(rst_file)
os.system(rm_sed1file_cmd)
os.system(rm_sed1file_cmd)
build_db_man_pages()
# List the xCAT component directory which contain pod pages
COMPONENTS = ['xCAT-SoftLayer', 'xCAT-test', 'xCAT-client', 'xCAT-vlan', 'perl-xCAT', 'xCAT-buildkit']
for component in COMPONENTS:
for component in COMPONENTS:
for root,dirs,files in os.walk("%s" %(component)):
for file in files:
# only interested in .pod files
# only interested in .pod files
if file.endswith(".pod"):
pod_input = os.path.join(root,file)
@@ -130,7 +130,7 @@ for component in COMPONENTS:
cmd = "perl -I %s/share/perl5 %s/bin/%s " %(prefix_path, prefix_path, POD2RST)
cmd += " --infile=%s --outfile=%s --title=%s.%s" %(pod_input, rst_output, title, man_ver)
# print cmd
# print cmd
os.system(cmd)
if man_ver == '1' or man_ver == '8':
fix_vertical_bar(rst_output)