<!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>[125594] users/g5pw/pypi2port</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/125594">125594</a></dd>
<dt>Author</dt> <dd>g5pw@macports.org</dd>
<dt>Date</dt> <dd>2014-09-22 02:54:21 -0700 (Mon, 22 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>No need to duplicate code, change to symlink for now</pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#usersg5pwpypi2portpypi2port">users/g5pw/pypi2port/pypi2port</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#usersg5pwpypi2portpypi2port">users/g5pw/pypi2port/pypi2port</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="usersg5pwpypi2portpypi2port"></a>
<div class="delfile"><h4>Deleted: users/g5pw/pypi2port/pypi2port (125593 => 125594)</h4>
<pre class="diff"><span>
<span class="info">--- users/g5pw/pypi2port/pypi2port        2014-09-22 09:54:17 UTC (rev 125593)
+++ users/g5pw/pypi2port/pypi2port        2014-09-22 09:54:21 UTC (rev 125594)
</span><span class="lines">@@ -1,797 +0,0 @@
</span><del>-#! /bin/sh
-&quot;&quot;&quot;:&quot;
-exec python $0 ${1+&quot;$@&quot;}
-&quot;&quot;&quot;
-__doc__ = &quot;&quot;&quot;...Script for pypi2port module written for &quot;The Macports Project&quot;
-             participating in Google Summer of Code 2014...&quot;&quot;&quot;
-
-# -*- coding: utf-8 -*-
-# !/usr/bin/env python
-
-import argparse
-import sys
-import os
-import urllib2
-import hashlib
-import zipfile
-from progressbar import *
-try:
-    import xmlrpclib
-except ImportError:
-    import xmlrpc.client as xmlrpclib
-import textwrap
-import string
-import shutil
-import re
-import difflib
-import subprocess
-import requests
-import shlex
-import getpass
-
-client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
-
-
-&quot;&quot;&quot; Lists all packages available in pypi database &quot;&quot;&quot;
-
-
-def list_all():
-    list_packages = client.list_packages()
-    for package in list_packages:
-        print package
-
-
-&quot;&quot;&quot; Searches for a particular package by the name classifier &quot;&quot;&quot;
-
-
-def search(pkg_name):
-    values = client.search({'name': pkg_name})
-    for value in values:
-        for key in value.keys():
-            print key, '--&gt;', value[key]
-
-
-&quot;&quot;&quot; Fetches the release data for a paticular package based on
-    the package_name and package_version &quot;&quot;&quot;
-
-
-def release_data(pkg_name, pkg_version):
-    if pkg_version:
-        values = client.release_data(pkg_name, pkg_version)
-        if values:
-            for key in values.keys():
-                print key, '--&gt;', values[key]
-        else:
-            print &quot;No such package found.&quot;
-            print &quot;Please specify the exact package name.&quot;
-        return
-    return
-
-
-&quot;&quot;&quot; Fetches the distfile for a particular package name and release_url &quot;&quot;&quot;
-
-
-def fetch(pkg_name, dict):
-    print &quot;Fetching distfiles...&quot;
-    checksum_md5 = dict['md5_digest']
-    parent_dir = './sources'
-    home_dir = parent_dir + '/' + 'python'
-    src_dir = home_dir + '/py-' + pkg_name
-    if not os.path.exists(parent_dir):
-        os.makedirs(parent_dir)
-    if not os.path.exists(home_dir):
-        os.makedirs(home_dir)
-    if not os.path.exists(src_dir):
-        os.makedirs(src_dir)
-
-    url = dict['url']
-    file_name = src_dir + '/' + dict['filename']
-
-    u = urllib2.urlopen(url)
-    with open(file_name, 'wb') as f:
-        meta = u.info()
-        file_size = int(meta.getheaders(&quot;Content-Length&quot;)[0])
-
-        widgets = ['Fetching: ', Percentage(), ' ',
-                   Bar(marker=RotatingMarker(), left='[', right=']'),
-                   ' ', ETA(), ' ', FileTransferSpeed()]
-        pbar = ProgressBar(widgets=widgets, maxval=int(file_size))
-        pbar.start()
-
-        file_size_dl = 0
-        block_sz = 1024
-        while True:
-            buffer = u.read(block_sz)
-            if not buffer:
-                break
-
-            file_size_dl += len(buffer)
-            f.write(buffer)
-            pbar.update(file_size_dl)
-
-        pbar.finish()
-
-    checksum_md5_calc = hashlib.md5(open(file_name).read()).hexdigest()
-    if str(checksum_md5) == str(checksum_md5_calc):
-        print 'Successfully fetched'
-        ext = file_name.split('.')[-1]
-        if ext == 'egg':
-            zip = zipfile.ZipFile(file_name)
-            for name in zip.namelist():
-                if name.split(&quot;/&quot;)[0] == &quot;EGG-INFO&quot;:
-                    zip.extract(name, src_dir)
-        return file_name
-    else:
-        print 'Aborting due to inconsistency on checksums\n'
-        try:
-            os.remove(file_name)
-        except OSError, e:
-            print &quot;Error: %s - %s.&quot; % (e.filename, e.strerror)
-        return False
-
-
-&quot;&quot;&quot; Checks for the checksums and dependecies for a particular python package
-    on the basis of package_name and package_version &quot;&quot;&quot;
-
-
-def fetch_url(pkg_name, pkg_version, checksum=False, deps=False):
-    values = client.release_urls(pkg_name, pkg_version)
-    if checksum:
-#        print values
-        for value in values:
-            if value['filename'].split('.')[-1] == 'gz' or value['filename'].split('.')[-1] == 'zip':
-                return fetch(pkg_name, value)
-    else:
-        for value in values:
-            return fetch(pkg_name, value)
-
-
-&quot;&quot;&quot; Finds dependencies for a particular package on the basis of
-    package_name and package_version &quot;&quot;&quot;
-
-
-def dependencies(pkg_name, pkg_version, deps=False):
-    flag = False
-    if not deps:
-        return
-    values = client.release_urls(pkg_name, pkg_version)
-    for value in values:
-        if not(value['filename'].split('.')[-1] == 'gz' or value['filename'].split('.')[-1] == 'zip'):
-            fetch(pkg_name, value)
-    try:
-        with open('./sources/python/py-'
-                  + pkg_name + '/EGG-INFO/requires.txt') as f:
-            list = f.readlines()
-            list = [x.strip('\n') for x in list]
-        f.close()
-        try:
-            if flag:
-                shutil.rmtree('./sources/python/py-' + pkg_name + '/EGG-INFO',
-                              ignore_errors=True)
-                items = os.listdir('./sources/python/py-' + pkg_name)
-                for item in items[:]:
-                    if not(item.split('.')[-1] == 'gz' or item.split('.')[-1] == 'zip'):
-                        os.remove('./sources/python/py-'
-                                  + pkg_name + '/' + item)
-                        items.remove(item)
-                if not items:
-                    os.rmdir('./sources/python/py-' + pkg_name)
-        except:
-            pass
-        return list
-    except:
-        try:
-            if flag:
-                shutil.rmtree('./sources/python/py-'+pkg_name+'/EGG-INFO',
-                              ignore_errors=True)
-                items = os.listdir('./sources/python/py-'+pkg_name)
-                for item in items[:]:
-                    if not(item.split('.')[-1] == 'gz' or item.split('.')[-1] == 'zip'):
-                        os.remove('./sources/python/py-'+pkg_name+'/'+item)
-                        items.remove(item)
-                if not items:
-                    os.rmdir('./sources/python/py-'+pkg_name)
-        except:
-            pass
-        return False
-
-
-&quot;&quot;&quot; Creates a diff file for an existent port &quot;&quot;&quot;
-
-
-def create_diff(old_file, new_file, diff_file):
-    with open(old_file) as f:
-        a = f.readlines()
-#    a = open(old_file).readlines()
-    with open(new_file) as f:
-        b = f.readlines()
-#    b = open(new_file).readlines()
-    diff_string = difflib.unified_diff(a, b, &quot;Portfile.orig&quot;, &quot;Portfile&quot;)
-    with open(diff_file, 'w') as d:
-        try:
-            while 1:
-                d.write(diff_string.next())
-        except:
-            pass
-
-
-&quot;&quot;&quot; Searches for an existent port by its name &quot;&quot;&quot;
-
-
-def search_port(name):
-    try:
-        command = &quot;port file name:^py-&quot; + name + &quot;$&quot;
-        command = command.split()
-        existing_portfile = \
-            subprocess.check_output(command, stderr=subprocess.STDOUT).strip()
-        return existing_portfile
-    except Exception, e:
-        return False
-
-
-&quot;&quot;&quot; Generates checksums for a package on the basis of the distfile fetched by
-    its package_name and package_version &quot;&quot;&quot;
-
-
-def checksums(pkg_name, pkg_version):
-    flag = False
-    print &quot;Attempting to fetch distfiles...&quot;
-    file_name = fetch_url(pkg_name, pkg_version, True)
-    if file_name:
-        checksums = []
-        try:
-            print &quot;Generating checksums...&quot;
-            command = &quot;openssl rmd160 &quot;+file_name
-            command = command.split()
-            rmd160 = subprocess.check_output(command, stderr=subprocess.STDOUT)
-            rmd160 = rmd160.split('=')[1].strip()
-            checksums.insert(0, rmd160)
-
-            command = &quot;openssl sha256 &quot;+file_name
-            command = command.split()
-            sha256 = subprocess.check_output(command, stderr=subprocess.STDOUT)
-            sha256 = sha256.split('=')[1].strip()
-            checksums.insert(1, sha256)
-
-            dir = '/'.join(file_name.split('/')[0:-1])
-            if flag:
-                os.remove(file_name)
-            try:
-                if flag:
-                    os.rmdir(dir)
-            except OSError as ex:
-                pass
-            return checksums
-        except:
-            print &quot;Error\n&quot;
-            return
-
-
-&quot;&quot;&quot; Searches if the distfile listed is present or not &quot;&quot;&quot;
-
-
-def search_distfile(name, version):
-    try:
-        url = client.release_urls(name, version)[0]['url']
-        r = requests.get(url, verify=False)
-        if not r.status_code == 200:
-            raise Error('No distfile')
-    except:
-        print &quot;No distfile found&quot;
-        print &quot;Please set a DISTFILE env var before generating the portfile&quot;
-        sys.exit(0)
-
-
-&quot;&quot;&quot; Maps the license passed to the already present list of
-    licences available in Macports &quot;&quot;&quot;
-
-
-def search_license(license):
-    license = license.lower()
-    patterns = ['.*mit.*', '.*apache.*2', '.*apache.*', '.*bsd.*', '.*agpl.*3',
-                '.*agpl.*2', '.*agpl.*', '.*affero.*3', '.*affero.*2',
-                '.*affero.*', '.*lgpl.*3', '.*lgpl.*2', '.*lgpl.*', '.*gpl.*3',
-                '.*gpl.*2', '.*gpl.*', '.*general.*public.*license.*3',
-                '.*general.*public.*license.*2',
-                '.*general.*public.*license.*', '.*mpl.*3', '.*mpl.*2',
-                '.*mpl.*', '.*python.*license.*', '^python$', '.*']
-    licenses = ['MIT', 'Apache-2', 'Apache', 'BSD', 'AGPL-3', 'AGPL-2', 'AGPL',
-                'AGPL-3', 'AGPL-2', 'AGPL', 'LGPL-3', 'LGPL-2', 'LGPL',
-                'GPL-3', 'GPL-2', 'GPL', 'GPL-3', 'GPL-2', 'GPL', 'MPL-3',
-                'MPL-2', 'MPL', 'Python', 'Python', 'NULL']
-    for i in range(len(patterns)):
-        match = re.search(patterns[i], license)
-        if match:
-            return licenses[i]
-
-
-&quot;&quot;&quot; Port Testing function for various phase implementations &quot;&quot;&quot;
-
-
-def port_testing(name, portv='27'):
-    euid = os.geteuid()
-    if euid:
-        args = ['sudo', sys.executable] + sys.argv + [os.environ]
-        os.execlpe('sudo', *args)
-
-    for phase in [port_fetch, port_checksum, port_extract, port_configure,
-                  port_build, port_destroot, port_clean]:
-        print phase.__name__
-        phase_output = phase(name, portv)
-        if phase_output:
-            print phase.__name__ + &quot; - SUCCESS&quot;
-        else:
-            print phase.__name__ + &quot; FAILED&quot;
-            port_clean(name, portv)
-            print &quot;Exiting&quot;
-            sys.exit(1)
-
-        euid = os.geteuid()
-        if euid:
-            args = ['sudo', sys.executable] + sys.argv + [os.environ]
-            os.execlpe('sudo', *args)
-
-
-&quot;&quot;&quot; Fetch phase implementation &quot;&quot;&quot;
-
-
-def port_fetch(name, portv='27'):
-    try:
-        command = &quot;sudo port -t fetch dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Checksum phase implementation &quot;&quot;&quot;
-
-
-def port_checksum(name, portv='27'):
-    try:
-        command = &quot;sudo port -t checksum dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Checksum phase implementation &quot;&quot;&quot;
-
-
-def port_extract(name, portv='27'):
-    try:
-        command = &quot;sudo port -t extract dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Patch phase implementation &quot;&quot;&quot;
-
-
-def port_patch(name, portv='27'):
-    try:
-        command = &quot;sudo port -t patch dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Configure phase implementation &quot;&quot;&quot;
-
-
-def port_configure(name, portv='27'):
-    try:
-        command = &quot;sudo port -t configure dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Build phase implementation &quot;&quot;&quot;
-
-
-def port_build(name, portv='27'):
-    try:
-        command = &quot;sudo port -t build dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Destroot phase implementation &quot;&quot;&quot;
-
-
-def port_destroot(name, portv='27'):
-    try:
-        command = &quot;sudo port -t destroot dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Clean phase implementation &quot;&quot;&quot;
-
-
-def port_clean(name, portv='27'):
-    try:
-        command = &quot;sudo port -t clean dports/python/py-&quot; + \
-                  name + &quot; subport=py&quot; + portv + &quot;-&quot; + name
-        command = command.split()
-        phase_output = subprocess.check_call(command, stderr=subprocess.STDOUT)
-        return True
-    except:
-        return False
-
-
-&quot;&quot;&quot; Creates a portfile on the basis of the release_data and release_url fetched
-    on the basis of package_name and package_version &quot;&quot;&quot;
-
-
-def create_portfile(dict, file_name, dict2):
-    search_distfile(dict['name'], dict['version'])
-    print &quot;Creating Portfile for pypi package &quot; + dict['name'] + &quot;...&quot;
-    with open(file_name, 'w') as file:
-        file.write('# -*- coding: utf-8; mode: tcl; tab-width: 4; ')
-        file.write('indent-tabs-mode: nil; c-basic-offset: 4 ')
-        file.write('-*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4\n')
-        file.write('# $Id$\n\n')
-        file.write('PortSystem          1.0\n')
-        file.write('PortGroup           python 1.0\n\n')
-
-        file.write('name                py-{0}\n'.format(dict['name']))
-        file.write('version             {0}\n'.format(dict['version']))
-
-        file.write('platforms           darwin\n')
-        license = dict['license']
-        license = search_license(license)
-        file.write('license             {0}\n'.format(license))
-
-        if dict['maintainer']:
-            maintainers = ' '.join(dict['maintainer'])
-            if not maintainers == &quot;UNKNOWN&quot;:
-                file.write('maintainers         {0}\n\n'.format(maintainers))
-            else:
-                file.write('maintainers         {0}\n\n'.format(
-                           os.getenv('maintainer', 'nomaintainer')))
-        else:
-            print &quot;No maintainers found...&quot;
-            print &quot;Looking for maintainers in environment variables...&quot;
-            file.write('maintainers         {0}\n\n'.format(
-                       os.getenv('maintainer', 'nomaintainer')))
-
-        summary = dict['summary']
-        if summary:
-            summary = re.sub(r'[\[\]\{\}\;\:\$\t\&quot;\'\`\=(--)]+',
-                             ' ', summary)
-            summary = re.sub(r'\s(\s)+', ' ', summary)
-            summary = summary.encode('utf-8')
-            summary = filter(lambda x: x in string.printable, summary)
-            sum_lines = textwrap.wrap(summary)
-            file.write('description         ')
-            for sum_line in sum_lines:
-                if sum_line:
-                    if not sum_lines.index(sum_line) == 0:
-                        file.write('                    ')
-                    if sum_line == sum_lines[-1]:
-                        file.write(&quot;{0}\n&quot;.format(sum_line))
-                    else:
-                        file.write(&quot;{0} \\\n&quot;.format(sum_line))
-        else:
-            file.write('description         None\n\n')
-        description = dict['description']
-#        if description:
-#            description = description.encode('utf-8')
-#            description = filter(lambda x: x in string.printable, description)
-#            description = re.sub(r'[\[\]\{\}\;\:\$\t\&quot;\'\`\=(--)]+',
-#                                 ' ', description)
-#            description = re.sub(r'\s(\s)+', ' ', description)
-#            lines = textwrap.wrap(description, width=70)
-#            file.write('long_description    ')
-#            for line in lines:
-#                if line and lines.index(line) &lt; 4:
-#                    if not lines.index(line) == 0:
-#                        file.write('                    ')
-#                    if lines.index(line) &gt;= 3:
-#                        file.write(&quot;{0}...\n&quot;.format(line))
-#                    elif line == lines[-1]:
-#                        file.write(&quot;{0}\n&quot;.format(line))
-#                    else:
-#                        file.write(&quot;{0} \\\n&quot;.format(line))
-#        else:
-#            file.write('long_description    ${description}\n\n')
-        file.write('long_description    ${description}\n\n')
-        home_page = dict['home_page']
-
-        if home_page and not home_page == 'UNKNOWN':
-            file.write('homepage            {0}\n'.format(home_page))
-        else:
-            print &quot;No homepage found...&quot;
-            print &quot;Looking for homepage in environment variables...&quot;
-            file.write('homepage            {0}\n'.format(
-                       os.getenv('home_page', '')))
-
-#        for item in dict2:
-#            if item['python_version'] == 'source':
-#                master_var = item['url']
-#                break
-#        print master_var
-#        master_site = '/'.join(master_var.split('/')[0:-1])
-#        print master_site
-#        sys.exit(1)
-
-        try:
-#                print dict2
-#                print dict2['url']
-                for item in dict2:
-                    if item['python_version'] == 'source':
-                        master_var = item['url']
-                        break
-#                print master_var
-                master_site = '/'.join(master_var.split('/')[0:-1])
-                ext = master_var.split('/')[-1].split('.')[-1]
-                if ext == 'zip':
-                    zip_set = True
-                else:
-                    zip_set = False
-#                print master_site
-        except:
-            if dict['release_url']:
-                master_site = dict['release_url']
-#                print master_site
-            else:
-                print &quot;No master site found...&quot;
-                print &quot;Looking for master site in environment variables...&quot;
-                master_site = os.getenv('master_site', '')
-        if master_site:
-            file.write('master_sites        {0}\n'.format(master_site))
-            master_site_exists = True
-        else:
-            master_site_exists = False
-
-        if zip_set:
-            file.write('use_zip             yes\n')
-            file.write('extract.mkdir       yes\n')
-
-        file.write('distname            {0}-{1}\n\n'.format(
-                   dict['name'], dict['version']))
-
-        print &quot;Attempting to generate checksums for &quot; + dict['name'] + &quot;...&quot;
-        checksums_values = checksums(dict['name'], dict['version'])
-        if checksums_values:
-            file.write('checksums           rmd160  {0} \\\n'.format(
-                       checksums_values[0]))
-            file.write('                    sha256  {0}\n\n'.format(
-                       checksums_values[1]))
-
-        python_vers = dict['requires_python']
-        if python_vers:
-            file.write('python.versions     25 26 27 {0}\n\n'.format(
-                       dict['requires_python']))
-        else:
-            file.write('python.versions     25 26 27 32 33 34\n\n')
-
-        print &quot;Finding dependencies...&quot;
-        file.write('if {${name} ne ${subport}} {\n')
-        file.write('    depends_build-append \\\n')
-        file.write('                        ' +
-                   'port:py${python.version}-setuptools\n')
-        deps = dependencies(dict['name'], dict['version'], True)
-        if deps:
-            for i,dep in enumerate(deps):
-                dep = dep.split('&gt;')[0].split('=')[0]
-                dep = dep.replace('[','').replace(']','')
-                deps[i] = dep
-#            print deps
-            for dep in deps:
-                if dep in ['setuptools', '', '\n']:
-                    while deps.count(dep) &gt; 0:
-                        deps.remove(dep)
-
-
-#            for dep in deps:
-#                dep = dep.split('&gt;')[0].split('=')[0]
-#                dep = dep.replace('[','').replace(']','')
-#            for item in ['setuptools', '', '\n']:
-#                while deps.count(item) &gt; 0:
-#                    deps.remove(item)
-            if len(deps) &gt; 0:
-                file.write('    depends_run-append \\\n')
-#                file.write('                        ' +
-#                           'port:py${python.version}-setuptools')
-#                file.write(&quot; \\\n&quot;)
-                for dep in deps[:-1]:
-                    file.write('                        ' +
-                               'port:py${python.version}-' +
-                               dep + ' \\\n')
-                else:
-                    file.write('                        ' +
-                               'port:py${python.version}-' +
-                               deps[-1] + '\n')
-            else:
-                file.write(&quot;\n&quot;)
-        file.write('\n')
-        file.write('    livecheck.type      none\n')
-        if master_site_exists:
-            file.write('} else {\n')
-            file.write('    livecheck.type      regex\n')
-            file.write('    livecheck.url       ${master_sites}\n')
-            file.write('}\n')
-        else:
-            file.write('}\n')
-    print &quot;Searching for existent port...&quot;
-    port_exists = search_port(dict['name'])
-    if port_exists:
-        print &quot;Creating diff...&quot;
-        old_file = port_exists
-        new_file = './dports/python/py-'+dict['name']+'/Portfile'
-        diff_file = './dports/python/py-'+dict['name']+'/patch.Portfile.diff'
-        create_diff(old_file, new_file, diff_file)
-        print str(os.path.abspath(diff_file))+&quot;\n&quot;
-#        with open(diff_file) as diff:
-#            print diff.read()
-        print &quot;\nIf you want to open a new ticket. Please visit&quot;
-        print &quot;https://trac.macports.org/auth/login/?next=/newticket&quot;
-        print &quot;to open a new ticket after logging in with your credentials.&quot;
-    else:
-        print &quot;No port found.&quot;
-
-
-&quot;&quot;&quot; Creates the directories and other commands necessary
-    for a development environment &quot;&quot;&quot;
-
-
-def print_portfile(pkg_name, pkg_version=None):
-    root_dir = os.path.abspath(&quot;./dports&quot;)
-    port_dir = os.path.join(root_dir, 'python')
-    home_dir = os.path.join(port_dir, 'py-'+pkg_name)
-    if not os.path.exists(root_dir):
-        os.makedirs(root_dir)
-        try:
-            command = 'portindex dports/'
-            command = command.split()
-            subprocess.call(command, stderr=subprocess.STDOUT)
-        except:
-            pass
-    if not os.path.exists(port_dir):
-        os.makedirs(port_dir)
-    if not os.path.exists(home_dir):
-        os.makedirs(home_dir)
-
-    print &quot;Attempting to fetch data from pypi...&quot;
-
-    dict = client.release_data(pkg_name, pkg_version)
-    dict2 = client.release_urls(pkg_name, pkg_version)
-    if dict and dict2:
-        print &quot;Data fetched successfully.&quot;
-    elif dict:
-        print &quot;Release Data fetched successfully.&quot;
-    elif dict2:
-        print &quot;Release url fetched successfully.&quot;
-    else:
-        print &quot;No data found.&quot;
-
-    file_name = os.path.join(home_dir, &quot;Portfile&quot;)
-    create_portfile(dict, file_name, dict2)
-    print &quot;SUCCESS\n&quot;
-
-
-&quot;&quot;&quot; Main function - Argument Parser &quot;&quot;&quot;
-
-
-def main(argv):
-    parser = argparse.ArgumentParser(description=&quot;Pypi2Port Tester&quot;)
-# Calls list_all() which lists al available python packages
-    parser.add_argument('-l', '--list', action='store_true', dest='list',
-                        default=False, required=False,
-                        help='List all packages')
-# Calls search with the package_name
-    parser.add_argument('-s', '--search', action='store', type=str,
-                        dest='packages_search', nargs='*', required=False,
-                        help='Search for a package')
-# Calls release_data with package_name and package_version
-    parser.add_argument('-d', '--data', action='store',
-                        dest='packages_data', nargs='*', type=str,
-                        help='Releases data for a package')
-# Calls fetch_url with the various package_releases
-    parser.add_argument('-f', '--fetch', action='store', type=str,
-                        dest='package_fetch', nargs='*', required=False,
-                        help='Fetches distfiles for a package')
-# Calls print_portfile with the release data available
-    parser.add_argument('-p', '--portfile', action='store', type=str,
-                        dest='package_portfile', nargs='*', required=False,
-                        help='Prints the portfile for a package')
-# Calls port_testing
-    parser.add_argument('-t', '--test', action='store', type=str,
-                        dest='package_test', nargs='*', required=False,
-                        help='Tests the portfile for various phase tests')
-    options = parser.parse_args()
-
-    if options.list:
-        list_all()
-        return
-
-
-    if options.packages_search:
-        for pkg_name in options.packages_search:
-            search(pkg_name)
-        return
-
-
-    if options.packages_data:
-        pkg_name = options.packages_data[0]
-        if len(options.packages_data) &gt; 1:
-            pkg_version = options.packages_data[1]
-            release_data(pkg_name, pkg_version)
-        else:
-            if client.package_releases(pkg_name):
-                pkg_version = client.package_releases(pkg_name)[0]
-                release_data(pkg_name, pkg_version)
-            else:
-                print &quot;No release found\n&quot;
-        return
-
-
-    if options.package_fetch:
-        pkg_name = options.package_fetch[0]
-        if len(options.package_fetch) &gt; 1:
-            pkg_version = options.package_fetch[1]
-            fetch_url(pkg_name, pkg_version)
-        else:
-            releases = client.package_releases(pkg_name)
-            if releases:
-                pkg_version = releases[0]
-                fetch_url(pkg_name, pkg_version)
-            else:
-                print &quot;No release found\n&quot;
-        return
-
-
-    if options.package_portfile:
-        pkg_name = options.package_portfile[0]
-        if len(options.package_portfile) &gt; 1:
-            pkg_version = options.package_portfile[1]
-            print_portfile(pkg_name, pkg_version)
-        else:
-            vers = client.package_releases(pkg_name)
-            if vers:
-                pkg_version = vers[0]
-                print_portfile(pkg_name, pkg_version)
-            else:
-                print &quot;No release found\n&quot;
-        return
-
-
-    if options.package_test:
-        if len(options.package_test) &gt; 0:
-            pkg_name = options.package_test[0]
-            port_testing(pkg_name)
-        else:
-            print &quot;No package name specified\n&quot;
-        return
-
-    parser.print_help()
-    parser.error(&quot;No input specified&quot;)
-
-if __name__ == &quot;__main__&quot;:
-    main(sys.argv[1:])
</del></span></pre></div>
<a id="usersg5pwpypi2portpypi2port"></a>
<div class="addfile"><h4>Added: users/g5pw/pypi2port/pypi2port (0 => 125594)</h4>
<pre class="diff"><span>
<span class="info">--- users/g5pw/pypi2port/pypi2port                                (rev 0)
+++ users/g5pw/pypi2port/pypi2port        2014-09-22 09:54:21 UTC (rev 125594)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+link pypi2port.py
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: users/g5pw/pypi2port/pypi2port
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnspecial"></a>
<div class="addfile"><h4>Added: svn:special</h4></div>
</div>

</body>
</html>