diff options
author | Joseph Hunkeler <jhunk@stsci.edu> | 2014-02-04 15:07:28 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunk@stsci.edu> | 2014-02-04 15:07:28 -0500 |
commit | 83844106186270cf2838cebfae88584906537e0f (patch) | |
tree | 1c369ab5a74919d0dd7d9e1830adeffc1cf89c5d | |
parent | c8031976d9589f221260574f39e56b778db507b6 (diff) | |
download | htc_utils-83844106186270cf2838cebfae88584906537e0f.tar.gz |
Add: Python 2.6 compat for format statements
Fix: Use absolute path instead of normalizing path
-rwxr-xr-x | condor_split.py | 10 | ||||
-rwxr-xr-x | condor_wrap.py | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/condor_split.py b/condor_split.py index 78b1feb..0e42da5 100755 --- a/condor_split.py +++ b/condor_split.py @@ -42,10 +42,10 @@ def path_search(p, ext, strip_components): path = os.path.join(os.path.sep.join(components), tail) else: # strip_components = strip_max - print("Warning: Cannot strip {} components from {} (max {})".format(strip_components, path, strip_max)) + print("Warning: Cannot strip {0} components from {1} (max {2})".format(strip_components, path, strip_max)) if VERBOSE: - print("[{}]:{}".format(index, path)) + print("[{0}]:{1}".format(index, path)) filenames.append(path) index += 1 return filenames @@ -65,7 +65,7 @@ def assign_chunks(manifest, chunks, output_dir, as_jobs=False): output_dir = os.path.abspath(output_dir) if VERBOSE: - print("Output directory: {}".format(output_dir)) + print("Output directory: {0}".format(output_dir)) if not os.path.exists(output_dir): os.makedirs(output_dir) @@ -84,7 +84,7 @@ def assign_chunks(manifest, chunks, output_dir, as_jobs=False): if dest: dest.close() if VERBOSE: - print("[{}]: {}, {} entries".format(label, os.path.basename(dest.name), written)) + print("[{0}]: {1}, {2} entries".format(label, os.path.basename(dest.name), written)) written = 0 dest = file(os.path.join(output_dir, "stdin." + str(label)), 'w') label += 1 @@ -117,7 +117,7 @@ def main(): index_at = 1 if VERBOSE: - print("{} files".format(len(files))) + print("{0} files".format(len(files))) if not files: exit(0) diff --git a/condor_wrap.py b/condor_wrap.py index 8d69530..19b9496 100755 --- a/condor_wrap.py +++ b/condor_wrap.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with htcondor_utils. If not, see <http://www.gnu.org/licenses/>. - import argparse import os import sys @@ -30,20 +29,21 @@ def main(): verbose = args.verbose - job = [os.path.normpath(args.job)] + job = [os.path.abspath(args.job)] indata = args.indata output = [] - if verbose: - print("Job: {}".format(job)) - if isinstance(indata, file): for line in indata.readlines(): line = line.strip() + line = os.path.abspath(line) output.append(line) else: output = indata compiled = job + output + if verbose: + print("Job: {0}".format(compiled)) + process = subprocess.Popen(compiled, stdout=sys.stdout, stderr=sys.stderr) process.communicate() process.wait() |