[122287] branches/gsoc14-pip2port/pypi2port.py
gaurav at macports.org
gaurav at macports.org
Sat Jul 19 13:22:35 PDT 2014
Revision: 122287
https://trac.macports.org/changeset/122287
Author: gaurav at macports.org
Date: 2014-07-19 13:22:35 -0700 (Sat, 19 Jul 2014)
Log Message:
-----------
Diff creation with existent port
Modified Paths:
--------------
branches/gsoc14-pip2port/pypi2port.py
Modified: branches/gsoc14-pip2port/pypi2port.py
===================================================================
--- branches/gsoc14-pip2port/pypi2port.py 2014-07-19 19:24:59 UTC (rev 122286)
+++ branches/gsoc14-pip2port/pypi2port.py 2014-07-19 20:22:35 UTC (rev 122287)
@@ -22,6 +22,7 @@
import string
import shutil
import re
+import difflib
client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
@@ -175,7 +176,34 @@
print ""
return False
+def create_diff(name, port):
+ diff_file = './dports/python/'+name+'/'+name+'.diff'
+ fromfile = './dports/python/'+name+'/Portfile'
+ tofile = '/opt/mports/trunk/dports/python/'+port+'/Portfile'
+ a = open(fromfile).readlines()
+ b = open(tofile).readlines()
+ diff_string = difflib.ndiff(a,b)
+ with open(diff_file, 'w') as d:
+ try:
+ while 1:
+ d.write(diff_string.next())
+ except:
+ pass
+
+def search_port(name):
+ for port in os.listdir('/opt/mports/trunk/dports/python'):
+ if '-' in port:
+ port = port.split('-')
+ prefix = port[0]
+ port = ''.join(port[1:])
+ if port == name:
+ if prefix:
+ port = prefix+'-'+port
+ create_diff(name, port)
+ return True
+ return False
+
def checksums(pkg_name, pkg_version):
flag = False
file_name = fetch_url(pkg_name, pkg_version, True)
@@ -335,7 +363,9 @@
else:
file.write('}\n')
+ search_port(dict['name'])
+
def print_portfile(pkg_name, pkg_version=None):
print "\n"
root_dir = os.path.abspath("./dports")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140719/8ae66e89/attachment.html>
More information about the macports-changes
mailing list