[123708] branches/gsoc14-pip2port/pypi2port

gaurav at macports.org gaurav at macports.org
Wed Aug 13 02:57:42 PDT 2014


Revision: 123708
          https://trac.macports.org/changeset/123708
Author:   gaurav at macports.org
Date:     2014-08-13 02:57:42 -0700 (Wed, 13 Aug 2014)
Log Message:
-----------
Updated executable

Modified Paths:
--------------
    branches/gsoc14-pip2port/pypi2port

Modified: branches/gsoc14-pip2port/pypi2port
===================================================================
--- branches/gsoc14-pip2port/pypi2port	2014-08-13 09:57:11 UTC (rev 123707)
+++ branches/gsoc14-pip2port/pypi2port	2014-08-13 09:57:42 UTC (rev 123708)
@@ -32,12 +32,18 @@
 client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
 
 
+""" Lists all packages available in pypi database """
+
+
 def list_all():
     list_packages = client.list_packages()
     for package in list_packages:
         print package
 
 
+""" Searches for a particular package by the name classifier """
+
+
 def search(pkg_name):
     values = client.search({'name': pkg_name})
     for value in values:
@@ -45,6 +51,10 @@
             print key, '-->', value[key]
 
 
+""" Fetches the release data for a paticular package based on
+    the package_name and package_version """
+
+
 def release_data(pkg_name, pkg_version):
     if pkg_version:
         values = client.release_data(pkg_name, pkg_version)
@@ -58,6 +68,9 @@
     return
 
 
+""" Fetches the distfile for a particular package name and release_url """
+
+
 def fetch(pkg_name, dict):
     print "Fetching distfiles..."
     checksum_md5 = dict['md5_digest']
@@ -118,6 +131,10 @@
         return False
 
 
+""" Checks for the checksums and dependecies for a particular python package
+    on the basis of package_name and package_version """
+
+
 def fetch_url(pkg_name, pkg_version, checksum=False, deps=False):
     values = client.release_urls(pkg_name, pkg_version)
     if checksum:
@@ -129,6 +146,10 @@
             return fetch(pkg_name, value)
 
 
+""" Finds dependencies for a particular package on the basis of
+    package_name and package_version """
+
+
 def dependencies(pkg_name, pkg_version, deps=False):
     flag = False
     if not deps:
@@ -175,6 +196,9 @@
         return False
 
 
+""" Creates a diff file for an existent port """
+
+
 def create_diff(old_file, new_file, diff_file):
     with open(old_file) as f:
         a = f.readlines()
@@ -191,6 +215,9 @@
             pass
 
 
+""" Searches for an existent port by its name """
+
+
 def search_port(name):
     try:
         command = "port file name:^py-" + name + "$"
@@ -202,6 +229,10 @@
         return False
 
 
+""" Generates checksums for a package on the basis of the distfile fetched by
+    its package_name and package_version """
+
+
 def checksums(pkg_name, pkg_version):
     flag = False
     print "Attempting to fetch distfiles..."
@@ -237,6 +268,9 @@
             return
 
 
+""" Searches if the distfile listed is present or not """
+
+
 def search_distfile(name, version):
     try:
         url = client.release_urls(name, version)[0]['url']
@@ -249,6 +283,10 @@
         sys.exit(0)
 
 
+""" Maps the license passed to the already present list of
+    licences available in Macports """
+
+
 def search_license(license):
     license = license.lower()
     patterns = ['.*mit.*', '.*apache.*2', '.*apache.*', '.*bsd.*', '.*agpl.*3',
@@ -268,6 +306,9 @@
             return licenses[i]
 
 
+""" Port Testing function for various phase implementations """
+
+
 def port_testing(name, portv='27'):
     euid = os.geteuid()
     if euid:
@@ -292,6 +333,9 @@
             os.execlpe('sudo', *args)
 
 
+""" Fetch phase implementation """
+
+
 def port_fetch(name, portv='27'):
     try:
         command = "sudo port -t fetch dports/python/py-" + \
@@ -303,6 +347,9 @@
         return False
 
 
+""" Checksum phase implementation """
+
+
 def port_checksum(name, portv='27'):
     try:
         command = "sudo port -t checksum dports/python/py-" + \
@@ -314,6 +361,9 @@
         return False
 
 
+""" Checksum phase implementation """
+
+
 def port_extract(name, portv='27'):
     try:
         command = "sudo port -t extract dports/python/py-" + \
@@ -325,6 +375,9 @@
         return False
 
 
+""" Patch phase implementation """
+
+
 def port_patch(name, portv='27'):
     try:
         command = "sudo port -t patch dports/python/py-" + \
@@ -336,6 +389,9 @@
         return False
 
 
+""" Configure phase implementation """
+
+
 def port_configure(name, portv='27'):
     try:
         command = "sudo port -t configure dports/python/py-" + \
@@ -347,6 +403,9 @@
         return False
 
 
+""" Build phase implementation """
+
+
 def port_build(name, portv='27'):
     try:
         command = "sudo port -t build dports/python/py-" + \
@@ -358,6 +417,9 @@
         return False
 
 
+""" Destroot phase implementation """
+
+
 def port_destroot(name, portv='27'):
     try:
         command = "sudo port -t destroot dports/python/py-" + \
@@ -369,6 +431,9 @@
         return False
 
 
+""" Clean phase implementation """
+
+
 def port_clean(name, portv='27'):
     try:
         command = "sudo port -t clean dports/python/py-" + \
@@ -380,6 +445,10 @@
         return False
 
 
+""" Creates a portfile on the basis of the release_data and release_url fetched
+    on the basis of package_name and package_version """
+
+
 def create_portfile(dict, file_name, dict2):
     search_distfile(dict['name'], dict['version'])
     print "Creating Portfile for pypi package " + dict['name'] + "..."
@@ -546,6 +615,10 @@
         print "No port found."
 
 
+""" Creates the directories and other commands necessary
+    for a development environment """
+
+
 def print_portfile(pkg_name, pkg_version=None):
     root_dir = os.path.abspath("./dports")
     port_dir = os.path.join(root_dir, 'python')
@@ -555,7 +628,7 @@
         try:
             command = 'portindex dports/'
             command = command.split()
-            subprocess.call(command,stderr=subprocess.STDOUT)
+            subprocess.call(command, stderr=subprocess.STDOUT)
         except:
             pass
     if not os.path.exists(port_dir):
@@ -581,6 +654,9 @@
     print "SUCCESS\n"
 
 
+""" Main function - Argument Parser """
+
+
 def main(argv):
     parser = argparse.ArgumentParser(description="Pypi2Port Tester")
     parser.add_argument('-l', '--list', action='store_true', dest='list',
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140813/f069af60/attachment-0001.html>


More information about the macports-changes mailing list