178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt	2020-02-13 15:45:51.942114727 -0700
178c4d4
@@ -48,7 +48,7 @@ endif ()
178c4d4
 add_prefix(doc_deps ../ ${MP_HEADERS})
178c4d4
 
178c4d4
 add_custom_target(doc
178c4d4
-  COMMAND python ${BUILD_DOCS}
178c4d4
+  COMMAND python3 ${BUILD_DOCS}
178c4d4
   DEPENDS conf.py ${doc_deps} ${amplgsl_docs})
178c4d4
 
178c4d4
 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ampl.github.io/
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py	2020-02-13 15:22:47.654450099 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 """
178c4d4
 Set up build environment on Ubuntu or other Debian-based
178c4d4
 Linux distribution.
178c4d4
@@ -10,7 +10,7 @@ buildbot: install buildbot slave
178c4d4
 """
178c4d4
 
178c4d4
 import platform, re, os, shutil
178c4d4
-from bootstrap import *
178c4d4
+from .bootstrap import *
178c4d4
 from subprocess import check_call, Popen, PIPE
178c4d4
 
178c4d4
 if __name__ == '__main__':
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py	2020-02-13 15:22:24.535839893 -0700
178c4d4
@@ -1,8 +1,7 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # Set up build environment on OS X Moutain Lion.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
-from bootstrap import *
178c4d4
+from .bootstrap import *
178c4d4
 import glob, os, sys, tempfile
178c4d4
 from subprocess import call, check_call
178c4d4
 
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py	2020-02-13 15:21:39.224603644 -0700
178c4d4
@@ -1,6 +1,5 @@
178c4d4
 # Common bootstrap functionality.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import glob, os, platform, re, shutil, sys
178c4d4
 import tarfile, tempfile, uuid, zipfile
178c4d4
 from contextlib import closing
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py	2020-02-13 15:23:25.110818565 -0700
178c4d4
@@ -1,8 +1,7 @@
178c4d4
 # Set up build environment on 64-bit Windows.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import os, shutil, tempfile
178c4d4
-from bootstrap import *
178c4d4
+from .bootstrap import *
178c4d4
 from glob import glob
178c4d4
 from subprocess import check_call, check_output
178c4d4
 
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py	2020-02-13 15:11:03.171308668 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 """
178c4d4
 Create a base docker image for Ubuntu Lucid.
178c4d4
 
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py	2020-02-14 10:11:07.288162263 -0700
178c4d4
@@ -1,12 +1,11 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 """Build documentation.
178c4d4
 
178c4d4
 Usage: build-docs.py [extract-docs <file>]
178c4d4
 """
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import fileutil, mmap, os, re, shutil
178c4d4
-from subprocess import call, check_call, check_output, Popen, PIPE
178c4d4
+from subprocess import check_call, Popen, PIPE
178c4d4
 from docopt import docopt
178c4d4
 
178c4d4
 mp_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
178c4d4
@@ -14,21 +13,6 @@ mp_dir = os.path.dirname(os.path.dirname
178c4d4
 def run(*args, **kwargs):
178c4d4
   check_call(args, **kwargs)
178c4d4
 
178c4d4
-def create_virtualenv(venv_dir):
178c4d4
-  "Create and activate virtualenv in the given directory."
178c4d4
-  # File "check" is used to make sure that we don't have
178c4d4
-  # a partial environment in case virtualenv was interrupted.
178c4d4
-  check_path = os.path.join(venv_dir, 'check')
178c4d4
-  if not os.path.exists(check_path):
178c4d4
-    run('virtualenv', venv_dir)
178c4d4
-    os.mknod(check_path)
178c4d4
-  # Activate virtualenv.
178c4d4
-  import sysconfig
178c4d4
-  scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
178c4d4
-  activate_this_file = os.path.join(venv_dir, scripts_dir, 'activate_this.py')
178c4d4
-  with open(activate_this_file) as f:
178c4d4
-    exec(f.read(), dict(__file__=activate_this_file))
178c4d4
-
178c4d4
 def extract_docs(filename, output_dir):
178c4d4
   "Extract the AMPLGSL documentation from the code."
178c4d4
   output = None
178c4d4
@@ -36,9 +20,9 @@ def extract_docs(filename, output_dir):
178c4d4
   if not os.path.exists(output_dir):
178c4d4
     os.mkdir(output_dir)
178c4d4
   with open(filename, 'r+b') as input:
178c4d4
-    map = mmap.mmap(input.fileno(), 0)
178c4d4
-    for i in re.finditer(r'/\*\*(.*?)\*/', map, re.DOTALL):
178c4d4
-      s = re.sub(r'\n +\* ?', r'\n', i.group(1))
178c4d4
+    mm = mmap.mmap(input.fileno(), 0)
178c4d4
+    for i in re.finditer(rb'/\*\*(.*?)\*/', mm, re.DOTALL):
178c4d4
+      s = re.sub(r'\n +\* ?', r'\n', i.group(1).decode('utf-8'))
178c4d4
       s = re.sub(r'\$(.+?)\$', r':math:`\1`', s, flags=re.DOTALL)
178c4d4
       m = re.search(r'@file (.*)', s)
178c4d4
       if m:
178c4d4
@@ -48,7 +32,7 @@ def extract_docs(filename, output_dir):
178c4d4
         output = open(os.path.join(output_dir, filename + '.rst'), 'w')
178c4d4
         s = s[:m.start()] + s[m.end():]
178c4d4
       output.write(s.rstrip(' '))
178c4d4
-    map.close()
178c4d4
+    mm.close()
178c4d4
 
178c4d4
 def get_mp_version():
178c4d4
   filename = os.path.join(os.path.dirname(__file__), '..', 'CMakeLists.txt')
178c4d4
@@ -58,13 +42,6 @@ def get_mp_version():
178c4d4
       if m:
178c4d4
         return m.group(1)
178c4d4
 
178c4d4
-def pip_install(package, **kwargs):
178c4d4
-  "Install package using pip."
178c4d4
-  commit = kwargs.get('commit')
178c4d4
-  if commit:
178c4d4
-    package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
178c4d4
-  run('pip', 'install', '-q', package)
178c4d4
-
178c4d4
 def copy_content(src_dir, dst_dir):
178c4d4
   "Copy content of the src_dir to dst_dir recursively."
178c4d4
   for entry in os.listdir(src_dir):
178c4d4
@@ -77,16 +54,11 @@ def copy_content(src_dir, dst_dir):
178c4d4
       shutil.copyfile(src, dst)
178c4d4
 
178c4d4
 def build_docs(workdir, doxygen='doxygen'):
178c4d4
-  create_virtualenv(os.path.join(workdir, 'build', 'virtualenv'))
178c4d4
-  # Install Sphinx and Breathe.
178c4d4
-  pip_install('sphinx==1.3.1')
178c4d4
-  pip_install('breathe', check_version='4.1.0')
178c4d4
-
178c4d4
   # Clone the ampl.github.io repo.
178c4d4
   repo = 'ampl.github.io'
178c4d4
   repo_dir = os.path.join(workdir, repo)
178c4d4
   if not os.path.exists(repo_dir):
178c4d4
-    run('git', 'clone', 'https://github.com/ampl/{}.git'.format(repo), cwd=workdir)
178c4d4
+    shutil.copytree(os.path.join(mp_dir, repo), repo_dir)
178c4d4
 
178c4d4
   # Copy API docs and the database connection guides to the build directory.
178c4d4
   # The guides are not stored in the mp repo to avoid polluting history with
178c4d4
@@ -129,7 +101,7 @@ def build_docs(workdir, doxygen='doxygen
178c4d4
       JAVADOC_AUTOBRIEF = YES
178c4d4
       ALIASES           = "rst=\verbatim embed:rst"
178c4d4
       ALIASES          += "endrst=\endverbatim"
178c4d4
-    '''.format(mp_dir))
178c4d4
+    '''.format(mp_dir).encode('utf-8'))
178c4d4
   returncode = p.returncode
178c4d4
   if returncode == 0:
178c4d4
     # Pass the MP version via environment variables rather than command-line
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py	2020-02-13 15:25:54.934292448 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 """Create AMPL demo packages.
178c4d4
 
178c4d4
 Usage:
178c4d4
@@ -8,14 +8,13 @@ Options:
178c4d4
   --cache  Cache downloaded packages (for debugging).
178c4d4
 """
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import fileutil, gzip, os, shutil, stat, subprocess
178c4d4
-import tarfile, tempfile, ctxtimer, urllib, zipfile
178c4d4
+import tarfile, tempfile, ctxtimer, urllib.request, urllib.parse, zipfile
178c4d4
 from docopt import docopt
178c4d4
 from glob import glob
178c4d4
 from sets import Set
178c4d4
-from StringIO import StringIO
178c4d4
-from urlparse import urlparse
178c4d4
+from io import StringIO
178c4d4
+from urllib.parse import urlparse
178c4d4
 
178c4d4
 # URL for downloading student versions of AMPL binaries.
178c4d4
 student_url = 'http://www.ampl.com/netlib/ampl/student/'
178c4d4
@@ -63,7 +62,7 @@ def retrieve_cached(url, system = None):
178c4d4
     print('Using cached version of', filename)
178c4d4
   else:
178c4d4
     print('Downloading', filename)
178c4d4
-    urllib.urlretrieve(url, cached_path)
178c4d4
+    urllib.request.urlretrieve(url, cached_path)
178c4d4
   return cached_path
178c4d4
 
178c4d4
 # Extract files from amplcml.zip.
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py	2020-02-13 15:24:36.877608531 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 
178c4d4
 """Create packages of AMPL solvers and libraries.
178c4d4
 
178c4d4
@@ -6,7 +6,6 @@ Usage:
178c4d4
   create-packages.py [update]
178c4d4
 """
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import docopt, fileutil, os, re, shutil, subprocess, tempfile, zipfile
178c4d4
 
178c4d4
 project = "ampl"
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py	2020-02-13 15:26:12.420997611 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 
178c4d4
 """Create a solver source package for AMPL use.
178c4d4
 
178c4d4
@@ -6,7 +6,6 @@ Usage:
178c4d4
   create-solver-packages.py <solver>
178c4d4
 """
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import docopt, os, zipfile
178c4d4
 
178c4d4
 mp_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py	2020-02-13 15:21:20.295922221 -0700
178c4d4
@@ -1,6 +1,5 @@
178c4d4
 # A with statement context based timer.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 from contextlib import contextmanager
178c4d4
 import sys, timeit
178c4d4
 
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py	2020-02-13 15:20:13.337049167 -0700
178c4d4
@@ -81,7 +81,7 @@ def transform(pattern):
178c4d4
     while groups:
178c4d4
         children = groups.pop(0)
178c4d4
         parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
178c4d4
-        if any(t in map(type, children) for t in parents):
178c4d4
+        if any(t in list(map(type, children)) for t in parents):
178c4d4
             child = [c for c in children if type(c) in parents][0]
178c4d4
             children.remove(child)
178c4d4
             if type(child) is Either:
178c4d4
@@ -181,12 +181,12 @@ class Option(LeafPattern):
178c4d4
 
178c4d4
     def __init__(self, short=None, long=None, argcount=0, value=False):
178c4d4
         assert argcount in (0, 1)
178c4d4
-        self.short, self.long, self.argcount = short, long, argcount
178c4d4
+        self.short, self.long, self.argcount = short, int, argcount
178c4d4
         self.value = None if value is False and argcount else value
178c4d4
 
178c4d4
     @classmethod
178c4d4
     def parse(class_, option_description):
178c4d4
-        short, long, argcount, value = None, None, 0, False
178c4d4
+        short, int, argcount, value = None, None, 0, False
178c4d4
         options, _, description = option_description.strip().partition('  ')
178c4d4
         options = options.replace(',', ' ').replace('=', ' ')
178c4d4
         for s in options.split():
178c4d4
@@ -199,7 +199,7 @@ class Option(LeafPattern):
178c4d4
         if argcount:
178c4d4
             matched = re.findall('\[default: (.*)\]', description, flags=re.I)
178c4d4
             value = matched[0] if matched else None
178c4d4
-        return class_(short, long, argcount, value)
178c4d4
+        return class_(short, int, argcount, value)
178c4d4
 
178c4d4
     def single_match(self, left):
178c4d4
         for n, pattern in enumerate(left):
178c4d4
@@ -300,21 +300,21 @@ class Tokens(list):
178c4d4
 
178c4d4
 def parse_long(tokens, options):
178c4d4
     """long ::= '--' chars [ ( ' ' | '=' ) chars ] ;"""
178c4d4
-    long, eq, value = tokens.move().partition('=')
178c4d4
-    assert long.startswith('--')
178c4d4
+    int, eq, value = tokens.move().partition('=')
178c4d4
+    assert int.startswith('--')
178c4d4
     value = None if eq == value == '' else value
178c4d4
-    similar = [o for o in options if o.long == long]
178c4d4
+    similar = [o for o in options if o.long == int]
178c4d4
     if tokens.error is DocoptExit and similar == []:  # if no exact match
178c4d4
-        similar = [o for o in options if o.long and o.long.startswith(long)]
178c4d4
+        similar = [o for o in options if o.long and o.long.startswith(int)]
178c4d4
     if len(similar) > 1:  # might be simply specified ambiguously 2+ times?
178c4d4
         raise tokens.error('%s is not a unique prefix: %s?' %
178c4d4
-                           (long, ', '.join(o.long for o in similar)))
178c4d4
+                           (int, ', '.join(o.long for o in similar)))
178c4d4
     elif len(similar) < 1:
178c4d4
         argcount = 1 if eq == '=' else 0
178c4d4
-        o = Option(None, long, argcount)
178c4d4
+        o = Option(None, int, argcount)
178c4d4
         options.append(o)
178c4d4
         if tokens.error is DocoptExit:
178c4d4
-            o = Option(None, long, argcount, value if argcount else True)
178c4d4
+            o = Option(None, int, argcount, value if argcount else True)
178c4d4
     else:
178c4d4
         o = Option(similar[0].short, similar[0].long,
178c4d4
                    similar[0].argcount, similar[0].value)
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py	2020-02-13 15:27:21.146838851 -0700
178c4d4
@@ -1,6 +1,6 @@
178c4d4
 # A file downloader.
178c4d4
 
178c4d4
-import contextlib, os, tempfile, ctxtimer, urllib2, urlparse
178c4d4
+import contextlib, os, tempfile, ctxtimer, urllib.request, urllib.error, urllib.parse
178c4d4
 
178c4d4
 class Downloader:
178c4d4
   def __init__(self, dir=None):
178c4d4
@@ -12,18 +12,18 @@ class Downloader:
178c4d4
   #  with d.download(url) as f:
178c4d4
   #    use_file(f)
178c4d4
   def download(self, url, cookie=None):
178c4d4
-    suffix = os.path.splitext(urlparse.urlsplit(url)[2])[1]
178c4d4
+    suffix = os.path.splitext(urllib.parse.urlsplit(url)[2])[1]
178c4d4
     fd, filename = tempfile.mkstemp(suffix=suffix, dir=self.dir)
178c4d4
     os.close(fd)
178c4d4
     with ctxtimer.print_time('Downloading', url, 'to', filename):
178c4d4
-      opener = urllib2.build_opener()
178c4d4
+      opener = urllib.request.build_opener()
178c4d4
       if cookie:
178c4d4
         opener.addheaders.append(('Cookie', cookie))
178c4d4
       num_tries = 2
178c4d4
       for i in range(num_tries):
178c4d4
         try:
178c4d4
           f = opener.open(url)
178c4d4
-        except urllib2.URLError, e:
178c4d4
+        except urllib.error.URLError as e:
178c4d4
           print('Failed to open url', url)
178c4d4
           continue
178c4d4
         length = f.headers.get('content-length')
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py	2020-02-13 15:23:52.255360892 -0700
178c4d4
@@ -1,6 +1,5 @@
178c4d4
 # File utils.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import errno, os, shutil, zipfile
178c4d4
 
178c4d4
 # Delete an entire directory tree if it exists.
178c4d4
@@ -31,7 +30,7 @@ def make_archive(archive_name, dirname):
178c4d4
         if os.path.islink(path):
178c4d4
           zipinfo = zipfile.ZipInfo(path)
178c4d4
           zipinfo.create_system = UNIX
178c4d4
-          zipinfo.external_attr = 2716663808L
178c4d4
+          zipinfo.external_attr = 2716663808
178c4d4
           zip.writestr(zipinfo, os.readlink(path))
178c4d4
         else:
178c4d4
           zip.write(path, path)
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py	2020-02-13 15:11:03.187308399 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # This scripts extract options from solvers and formats them in HTML.
178c4d4
 
178c4d4
 import errno, os, sys
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py	2020-02-13 15:21:02.537221108 -0700
178c4d4
@@ -1,7 +1,6 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # Build the project on Travis CI.
178c4d4
 
178c4d4
-from __future__ import print_function
178c4d4
 import os, re, shutil, tarfile, tempfile
178c4d4
 from bootstrap import bootstrap
178c4d4
 from contextlib import closing
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py	2020-02-13 15:11:03.177308567 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # Updates dependencies integrated into the source tree such as C++ Format.
178c4d4
 
178c4d4
 import download, os, re, shutil, zipfile, fileutil
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py	2020-02-13 15:11:03.176308584 -0700
178c4d4
@@ -1,4 +1,4 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # This script updates the "netlib" branch from the AMPL Solver Library
178c4d4
 # repository at rsync ampl.com::ampl/
178c4d4
 
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py	2020-02-13 15:17:56.691348963 -0700
178c4d4
@@ -1,11 +1,11 @@
178c4d4
-#!/usr/bin/env python
178c4d4
+#!/usr/bin/python3
178c4d4
 # This scripts generates test .nl files from AMPL model and data files.
178c4d4
 
178c4d4
 from subprocess import Popen, PIPE
178c4d4
 
178c4d4
 def generate_nl_file(stub, *files, **kwargs):
178c4d4
   code = ''
178c4d4
-  for key, value in kwargs.iteritems():
178c4d4
+  for key, value in kwargs.items():
178c4d4
     if key == 'code':
178c4d4
       code = value
178c4d4
     else:
178c4d4
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py
178c4d4
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py.orig	2019-12-09 11:21:17.000000000 -0700
178c4d4
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py	2020-02-13 15:18:38.826639813 -0700
178c4d4
@@ -1,5 +1,5 @@
178c4d4
 import sys
178c4d4
-from cStringIO import StringIO
178c4d4
+from io import StringIO
178c4d4
 
178c4d4
 # Captures output to stdout in a block.
178c4d4
 # Usage: