ellert pushed to nordugrid-arc (el5). "Backport removal of python print statements (fixes pylint errors)"
notifications at fedoraproject.org
notifications at fedoraproject.org
Sat Mar 28 10:46:29 UTC 2015
>From efc74dbd7e3e4f1876ce5132138d134e08d24273 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert at fysast.uu.se>
Date: Sat, 7 Mar 2015 17:57:52 +0100
Subject: Backport removal of python print statements (fixes pylint errors)
diff --git a/nordugrid-arc-python-print.patch b/nordugrid-arc-python-print.patch
new file mode 100644
index 0000000..a0d65f2
--- /dev/null
+++ b/nordugrid-arc-python-print.patch
@@ -0,0 +1,273 @@
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/basic_job_submission.py nordugrid-arc-4.2.0/python/examples/basic_job_submission.py
+--- nordugrid-arc-4.2.0.orig/python/examples/basic_job_submission.py 2013-03-07 07:18:00.663664000 +0100
++++ nordugrid-arc-4.2.0/python/examples/basic_job_submission.py 2015-03-07 13:21:57.886078354 +0100
+@@ -40,4 +40,4 @@
+ logger.msg(arc.WARNING, "Failed to write to local job list %s", usercfg.JobListFile())
+
+ # Job submitted ok
+-print "Job submitted with job id %s" % jobs.front().JobID
++sys.stdout.write("Job submitted with job id %s\n" % str(jobs.front().JobID))
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/copy_file.py nordugrid-arc-4.2.0/python/examples/copy_file.py
+--- nordugrid-arc-4.2.0.orig/python/examples/copy_file.py 2012-12-07 10:59:47.390328000 +0100
++++ nordugrid-arc-4.2.0/python/examples/copy_file.py 2015-03-07 13:26:32.635817486 +0100
+@@ -12,7 +12,7 @@
+ arc.ThreadInitializer().waitExit()
+
+ def usage():
+- print(' Usage: copy_file.py source destination')
++ sys.stdout.write(' Usage: copy_file.py source destination\n')
+
+ if len(sys.argv) != 3:
+ usage()
+@@ -50,4 +50,4 @@
+ status = mover.Transfer(source, destination, arc.FileCache(), arc.URLMap())
+
+ # Print the exit status of the transfer
+-print (str(status))
++sys.stdout.write("%s\n"%str(status))
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/dtr_generator.py nordugrid-arc-4.2.0/python/examples/dtr_generator.py
+--- nordugrid-arc-4.2.0.orig/python/examples/dtr_generator.py 2013-03-06 13:59:22.512297000 +0100
++++ nordugrid-arc-4.2.0/python/examples/dtr_generator.py 2015-03-07 13:35:01.436871466 +0100
+@@ -53,15 +53,15 @@
+ # Since the callback is not available, wait until the transfer reaches a final state
+ while dtrptr.get_status() != arc.DTRStatus.ERROR and dtrptr.get_status() != arc.DTRStatus.DONE:
+ time.sleep(1)
+- print dtrptr.get_status().str()
++ sys.stdout.write("%s\n"%dtrptr.get_status().str())
+
+ # This is never called in the current version
+ def receiveDTR(self, dtr):
+- print 'Received back DTR', dtr.get_id()
++ sys.stdout.write('Received back DTR %s\n'%str(dtr.get_id()))
+
+ def main(args):
+ if len(args) != 3:
+- print "Usage: python dtr_generator.py source destination"
++ sys.stdout.write("Usage: python dtr_generator.py source destination\n")
+ sys.exit(1)
+ generator = DTRGenerator()
+ generator.add(args[1], args[2])
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/job_filtering.py nordugrid-arc-4.2.0/python/examples/job_filtering.py
+--- nordugrid-arc-4.2.0.orig/python/examples/job_filtering.py 2012-03-23 09:12:50.352163000 +0100
++++ nordugrid-arc-4.2.0/python/examples/job_filtering.py 2015-03-07 13:37:02.098782997 +0100
+@@ -12,32 +12,32 @@
+
+ # Retrieve all the jobs from this computing element
+ endpoint = arc.Endpoint("piff.hep.lu.se:443/arex", arc.Endpoint.COMPUTINGINFO)
+- print "Querying %s for jobs..." % endpoint.str()
++ sys.stdout.write("Querying %s for jobs...\n" % endpoint.str())
+ jobs = arc.JobContainer()
+ retriever = arc.JobListRetriever(uc)
+ retriever.addConsumer(jobs)
+ retriever.addEndpoint(endpoint)
+ retriever.wait()
+
+- print "%s jobs found" % len(jobs)
++ sys.stdout.write("%s jobs found\n" % len(jobs))
+
+ # Create a JobSupervisor to handle all the jobs
+ job_supervisor = arc.JobSupervisor(uc, jobs)
+
+- print "Getting job states..."
++ sys.stdout.write("Getting job states...\n")
+ # Update the states of the jobs
+ job_supervisor.Update()
+
+ # Get the updated jobs
+ jobs = job_supervisor.GetAllJobs()
+
+- print "The jobs have the following states:", ", ".join([job.State.GetGeneralState() for job in jobs])
++ sys.stdout.write("The jobs have the following states: %s\n"%(", ".join([job.State.GetGeneralState() for job in jobs])))
+
+ # Select failed jobs
+ job_supervisor.SelectByStatus(["Failed"])
+ failed_jobs = job_supervisor.GetSelectedJobs()
+
+- print "The failed jobs:"
++ sys.stdout.write("The failed jobs:\n")
+ for job in failed_jobs:
+ job.SaveToStream(arc.CPyOstream(sys.stdout), True)
+
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/joblist_retrieval.py nordugrid-arc-4.2.0/python/examples/joblist_retrieval.py
+--- nordugrid-arc-4.2.0.orig/python/examples/joblist_retrieval.py 2012-03-23 09:12:50.352163000 +0100
++++ nordugrid-arc-4.2.0/python/examples/joblist_retrieval.py 2015-03-07 14:09:53.514224333 +0100
+@@ -28,9 +28,9 @@
+ retriever.wait()
+
+ # Get the status of the retrieval
+- print retriever.getStatusOfEndpoint(endpoint).str()
++ sys.stdout.write("%s\n"%retriever.getStatusOfEndpoint(endpoint).str())
+
+- print "Number of jobs found:", len(jobs)
++ sys.stdout.write("Number of jobs found: %d\n"%len(jobs))
+ for job in jobs:
+ job.SaveToStream(arc.CPyOstream(sys.stdout), True)
+
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/job_status.py nordugrid-arc-4.2.0/python/examples/job_status.py
+--- nordugrid-arc-4.2.0.orig/python/examples/job_status.py 2012-11-17 12:53:27.099019000 +0100
++++ nordugrid-arc-4.2.0/python/examples/job_status.py 2015-03-07 13:22:03.816137474 +0100
+@@ -17,7 +17,7 @@
+ job.JobManagementURL = arc.URL("https://piff.hep.lu.se:443/arex")
+ job.JobStatusURL = arc.URL("https://piff.hep.lu.se:443/arex")
+
+- print "Job object before update:"
++ sys.stdout.write("Job object before update:\n")
+ job.SaveToStream(arc.CPyOstream(sys.stdout), True)
+
+ job_supervisor = arc.JobSupervisor(uc, [job])
+@@ -29,7 +29,7 @@
+ jobs = job_supervisor.GetAllJobs()
+ job = jobs[0]
+
+- print "Job object after update:"
++ sys.stdout.write("Job object after update:\n")
+ job.SaveToStream(arc.CPyOstream(sys.stdout), True)
+
+ # wait for all the background threads to finish before we destroy the objects they may use
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/job_submission.py nordugrid-arc-4.2.0/python/examples/job_submission.py
+--- nordugrid-arc-4.2.0.orig/python/examples/job_submission.py 2012-03-23 09:12:50.352163000 +0100
++++ nordugrid-arc-4.2.0/python/examples/job_submission.py 2015-03-07 14:02:06.397272155 +0100
+@@ -33,19 +33,19 @@
+ success = False;
+ # Submit job directly to the execution targets, without a broker
+ for target in targets:
+- print "Trying to submit to", target.ComputingEndpoint.URLString, "(%s)" % target.ComputingEndpoint.InterfaceName, "...",
++ sys.stdout.write("Trying to submit to %s (%s) ... "%(target.ComputingEndpoint.URLString, target.ComputingEndpoint.InterfaceName))
+ sys.stdout.flush()
+ success = target.Submit(uc, jobdesc, job)
+ if success:
+- print "succeeded!"
++ sys.stdout.write("succeeded!\n")
+ break
+ else:
+- print "failed!"
++ sys.stdout.write("failed!\n")
+ if success:
+- print "Job was submitted:"
++ sys.stdout.write("Job was submitted:\n")
+ job.SaveToStream(arc.CPyOstream(sys.stdout), False)
+ else:
+- print "Job submission failed"
++ sys.stdout.write("Job submission failed\n")
+
+ # wait for all the background threads to finish before we destroy the objects they may use
+ import atexit
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/partial_copy.py nordugrid-arc-4.2.0/python/examples/partial_copy.py
+--- nordugrid-arc-4.2.0.orig/python/examples/partial_copy.py 2013-03-04 14:12:41.308612000 +0100
++++ nordugrid-arc-4.2.0/python/examples/partial_copy.py 2015-03-07 14:08:08.273108755 +0100
+@@ -2,7 +2,7 @@
+ import sys
+
+ if len(sys.argv) != 2:
+- print "Usage: python partial_copy.py filename"
++ sys.stdout.write("Usage: python partial_copy.py filename\n")
+ sys.exit(1)
+
+ desired_size = 512
+@@ -13,7 +13,7 @@
+ point.SetSecure(False) # GridFTP servers generally do not have encrypted data channel
+ info = arc.FileInfo("")
+ point.Stat(info)
+-print "Name: ", info.GetName()
++sys.stdout.write("Name: %s\n"%str(info.GetName()))
+ fsize = info.GetSize()
+ if fsize > desired_size:
+ point.Range(fsize-desired_size,fsize-1)
+@@ -25,6 +25,6 @@
+ offset = 0
+ ( r, n, length, offset, buf) = buffer.for_write(True)
+ if not r: break
+- print "BUFFER: ", offset, ": ", length, " :", buf
++ sys.stdout.write("BUFFER: %d : %d : %s\n"%(offset, length, str(buf)))
+ buffer.is_written(n);
+ point.StopReading()
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/retrieving_results.py nordugrid-arc-4.2.0/python/examples/retrieving_results.py
+--- nordugrid-arc-4.2.0.orig/python/examples/retrieving_results.py 2013-03-06 10:28:17.275209000 +0100
++++ nordugrid-arc-4.2.0/python/examples/retrieving_results.py 2015-03-07 14:44:52.554508030 +0100
+@@ -16,12 +16,12 @@
+ job.Flavour = "ARC1"
+ job.ServiceInformationURL = job.JobStatusURL = job.JobManagementURL = arc.URL("https://piff.hep.lu.se:443/arex")
+
+- print "Get job information from the computing element..."
++ sys.stdout.write("Get job information from the computing element...\n")
+ # Put the job into a JobSupervisor and update its information
+ job_supervisor = arc.JobSupervisor(uc, [job])
+ job_supervisor.Update()
+
+- print "Downloading results..."
++ sys.stdout.write("Downloading results...\n")
+ # Prepare a list for storing the directories for the downloaded job results (if there would be more jobs)
+ downloadeddirectories = arc.StringList()
+ # Start retrieving results of all the selected jobs
+@@ -31,12 +31,12 @@
+ # collect the downloaded directories into the variable "downloadeddirectories" (forth argument)
+ success = job_supervisor.Retrieve("/tmp", False, False, downloadeddirectories)
+ if not success:
+- print "Downloading results failed."
++ sys.stdout.write("Downloading results failed.\n")
+ for downloadeddirectory in downloadeddirectories:
+- print "Job results were downloaded to", downloadeddirectory
+- print "Contents of the directory:"
++ sys.stdout.write("Job results were downloaded to %s\n"%str(downloadeddirectory))
++ sys.stdout.write("Contents of the directory:\n")
+ for filename in os.listdir(downloadeddirectory):
+- print " ", filename
++ sys.stdout.write(" %s\n"%filename)
+
+ # wait for all the background threads to finish before we destroy the objects they may use
+ import atexit
+diff -ur nordugrid-arc-4.2.0.orig/python/examples/service_discovery.py nordugrid-arc-4.2.0/python/examples/service_discovery.py
+--- nordugrid-arc-4.2.0.orig/python/examples/service_discovery.py 2013-12-12 12:18:37.957298000 +0100
++++ nordugrid-arc-4.2.0/python/examples/service_discovery.py 2015-03-07 14:16:28.881415310 +0100
+@@ -8,12 +8,12 @@
+ # to use in case of HTTPS connections
+ retriever = arc.ComputingServiceRetriever(uc, endpoints)
+ # the constructor of the ComputingServiceRetriever returns immediately
+- print
+- print "ComputingServiceRetriever created with the following endpoints:"
++ sys.stdout.write('\n')
++ sys.stdout.write("ComputingServiceRetriever created with the following endpoints:\n")
+ for endpoint in endpoints:
+- print "-", endpoint.str()
++ sys.stdout.write("- %s\n"%endpoint.str())
+ # here we want to wait until all the results arrive
+- print "Waiting for the results..."
++ sys.stdout.write("Waiting for the results...\n")
+ retriever.wait()
+ return retriever
+
+@@ -36,11 +36,11 @@
+ retriever = retrieve(uc, registries)
+
+ # The retriever acts as a list containing all the discovered ComputingServices:
+- print "Discovered ComputingServices:", ", ".join([service.Name for service in retriever])
++ sys.stdout.write("Discovered ComputingServices: %s\n"%(", ".join([service.Name for service in retriever])))
+
+ # Get all the ExecutionTargets on these ComputingServices
+ targets = retriever.GetExecutionTargets()
+- print "Number of ExecutionTargets on these ComputingServices:", len(targets)
++ sys.stdout.write("Number of ExecutionTargets on these ComputingServices: %d\n"%len(targets))
+
+ # Query the local infosys (COMPUTINGINFO) of computing elements
+ computing_elements = [
+@@ -55,9 +55,9 @@
+ # Get all the ExecutionTargets on these ComputingServices
+ targets2 = retriever2.GetExecutionTargets()
+
+- print "The discovered ExecutionTargets:"
++ sys.stdout.write("The discovered ExecutionTargets:\n")
+ for target in targets2:
+- print target
++ sys.stdout.write("%s\n"%str(target))
+
+
+ # Query both registries and computing elements at the same time:
+@@ -68,7 +68,7 @@
+
+ retriever3 = retrieve(uc, endpoints)
+
+- print "Discovered ComputingServices:", ", ".join([service.Name for service in retriever3])
++ sys.stdout.write("Discovered ComputingServices: %s\n"%(", ".join([service.Name for service in retriever3])))
+
+
+ # wait for all the background threads to finish before we destroy the objects they may use
diff --git a/nordugrid-arc.spec b/nordugrid-arc.spec
index 4c50c4c..275b0e2 100644
--- a/nordugrid-arc.spec
+++ b/nordugrid-arc.spec
@@ -95,7 +95,7 @@
Name: nordugrid-arc
Version: 4.2.0
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Advanced Resource Connector Grid Middleware
Group: System Environment/Daemons
License: ASL 2.0
@@ -103,6 +103,7 @@ URL: http://www.nordugrid.org/
Source: http://download.nordugrid.org/packages/%{name}/releases/%{version}/src/%{name}-%{version}.tar.gz
Patch0: %{name}-init.patch
Patch1: %{name}-sedfix.patch
+Patch2: %{name}-python-print.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# Packages dropped without replacements
@@ -773,6 +774,7 @@ developers.
touch -r configure.ac x
%patch1 -p1
touch -r x configure.ac
+%patch2 -p1
%if %{?fedora}%{!?fedora:0} <= 9 && %{?rhel}%{!?rhel:0} <= 5
# Older versions of SELinux does not have policy for open
@@ -1542,6 +1544,9 @@ service fetch-crl-cron start > /dev/null 2>&1
%doc %{_mandir}/man1/arcperftest.1*
%changelog
+* Sat Mar 07 2015 Mattias Ellert <mattias.ellert at fysast.uu.se> - 4.2.0-5
+- Backport removal of python print statements (fixes pylint errors)
+
* Mon Dec 22 2014 Mattias Ellert <mattias.ellert at fysast.uu.se> - 4.2.0-4
- Backport fix for broken sed statement in configure.ac
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/nordugrid-arc.git/commit/?h=el5&id=efc74dbd7e3e4f1876ce5132138d134e08d24273
More information about the scm-commits
mailing list