<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[125603] users/g5pw/pypi2port/pypi2port.py</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/125603">125603</a></dd>
<dt>Author</dt> <dd>g5pw@macports.org</dd>
<dt>Date</dt> <dd>2014-09-22 12:10:35 -0700 (Mon, 22 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add second newline before functions</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#usersg5pwpypi2portpypi2portpy">users/g5pw/pypi2port/pypi2port.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="usersg5pwpypi2portpypi2portpy"></a>
<div class="modfile"><h4>Modified: users/g5pw/pypi2port/pypi2port.py (125602 => 125603)</h4>
<pre class="diff"><span>
<span class="info">--- users/g5pw/pypi2port/pypi2port.py        2014-09-22 19:03:13 UTC (rev 125602)
+++ users/g5pw/pypi2port/pypi2port.py        2014-09-22 19:10:35 UTC (rev 125603)
</span><span class="lines">@@ -29,12 +29,14 @@
</span><span class="cx"> 
</span><span class="cx"> client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def list_all():
</span><span class="cx">     &quot;&quot;&quot; Lists all packages available in pypi database &quot;&quot;&quot;
</span><span class="cx">     list_packages = client.list_packages()
</span><span class="cx">     for package in list_packages:
</span><span class="cx">         print package
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def search(pkg_name):
</span><span class="cx">     &quot;&quot;&quot; Searches for a particular package by the name classifier &quot;&quot;&quot;
</span><span class="cx">     values = client.search({'name': pkg_name})
</span><span class="lines">@@ -42,6 +44,7 @@
</span><span class="cx">         for key in value.keys():
</span><span class="cx">             print key, '--&gt;', value[key]
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def release_data(pkg_name, pkg_version):
</span><span class="cx">     &quot;&quot;&quot; Fetches the release data for a paticular package based on
</span><span class="cx">     the package_name and package_version &quot;&quot;&quot;
</span><span class="lines">@@ -56,6 +59,7 @@
</span><span class="cx">         return
</span><span class="cx">     return
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def fetch(pkg_name, dict):
</span><span class="cx">     &quot;&quot;&quot; Fetches the distfile for a particular package name and release_url &quot;&quot;&quot;
</span><span class="cx">     print &quot;Fetching distfiles...&quot;
</span><span class="lines">@@ -115,6 +119,7 @@
</span><span class="cx">             print &quot;Error: %s - %s.&quot; % (e.filename, e.strerror)
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def fetch_url(pkg_name, pkg_version, checksum=False, deps=False):
</span><span class="cx">     &quot;&quot;&quot; Checks for the checksums and dependecies for a particular python package
</span><span class="cx">     on the basis of package_name and package_version &quot;&quot;&quot;
</span><span class="lines">@@ -128,6 +133,7 @@
</span><span class="cx">         for value in values:
</span><span class="cx">             return fetch(pkg_name, value)
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def dependencies(pkg_name, pkg_version, deps=False):
</span><span class="cx">     &quot;&quot;&quot; Finds dependencies for a particular package on the basis of
</span><span class="cx">     package_name and package_version &quot;&quot;&quot;
</span><span class="lines">@@ -175,6 +181,7 @@
</span><span class="cx">             pass
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def create_diff(old_file, new_file, diff_file):
</span><span class="cx">     &quot;&quot;&quot; Creates a diff file for an existent port &quot;&quot;&quot;
</span><span class="cx">     with open(old_file) as f:
</span><span class="lines">@@ -191,6 +198,7 @@
</span><span class="cx">         except:
</span><span class="cx">             pass
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def search_port(name):
</span><span class="cx">     &quot;&quot;&quot; Searches for an existent port by its name &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -202,6 +210,7 @@
</span><span class="cx">     except Exception:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def checksums(pkg_name, pkg_version):
</span><span class="cx">     &quot;&quot;&quot; Generates checksums for a package on the basis of the distfile fetched by
</span><span class="cx">     its package_name and package_version &quot;&quot;&quot;
</span><span class="lines">@@ -237,6 +246,7 @@
</span><span class="cx">             print &quot;Error\n&quot;
</span><span class="cx">             return
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def search_distfile(name, version):
</span><span class="cx">     &quot;&quot;&quot; Searches if the distfile listed is present or not &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -249,6 +259,7 @@
</span><span class="cx">         print &quot;Please set a DISTFILE env var before generating the portfile&quot;
</span><span class="cx">         sys.exit(0)
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def search_license(license):
</span><span class="cx">     &quot;&quot;&quot; Maps the license passed to the already present list of
</span><span class="cx">     licences available in Macports &quot;&quot;&quot;
</span><span class="lines">@@ -269,6 +280,7 @@
</span><span class="cx">         if match:
</span><span class="cx">             return licenses[i]
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_testing(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Port Testing function for various phase implementations &quot;&quot;&quot;
</span><span class="cx">     euid = os.geteuid()
</span><span class="lines">@@ -293,6 +305,7 @@
</span><span class="cx">             args = ['sudo', sys.executable] + sys.argv + [os.environ]
</span><span class="cx">             os.execlpe('sudo', *args)
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_fetch(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Fetch phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -304,6 +317,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_checksum(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Checksum phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -315,6 +329,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_extract(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Checksum phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -326,6 +341,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_patch(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Patch phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -337,6 +353,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_configure(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Configure phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -348,6 +365,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_build(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Build phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -359,6 +377,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_destroot(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Destroot phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -370,6 +389,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def port_clean(name, portv='27'):
</span><span class="cx">     &quot;&quot;&quot; Clean phase implementation &quot;&quot;&quot;
</span><span class="cx">     try:
</span><span class="lines">@@ -381,6 +401,7 @@
</span><span class="cx">     except:
</span><span class="cx">         return False
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def create_portfile(dict, file_name, dict2):
</span><span class="cx">     &quot;&quot;&quot; Creates a portfile on the basis of the release_data and release_url fetched
</span><span class="cx">     on the basis of package_name and package_version &quot;&quot;&quot;
</span><span class="lines">@@ -591,6 +612,7 @@
</span><span class="cx">     else:
</span><span class="cx">         print &quot;No port found.&quot;
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def print_portfile(pkg_name, pkg_version=None):
</span><span class="cx">     &quot;&quot;&quot; Creates the directories and other commands necessary
</span><span class="cx">     for a development environment &quot;&quot;&quot;
</span><span class="lines">@@ -627,6 +649,7 @@
</span><span class="cx">     create_portfile(dict, file_name, dict2)
</span><span class="cx">     print &quot;SUCCESS\n&quot;
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> def main(argv):
</span><span class="cx">     &quot;&quot;&quot; Main function - Argument Parser &quot;&quot;&quot;
</span><span class="cx">     parser = argparse.ArgumentParser(description=&quot;Pypi2Port Tester&quot;)
</span></span></pre>
</div>
</div>

</body>
</html>