
"""
Usage::

    import install_visual_studio_wrapper
    install_visual_studio_wrapper.install()

"""

import shutil
import sys

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen

SCRIPT_URL = \
    "https://raw.githubusercontent.com/ogrisel/python-appveyor-demo/" \
    "f54ec3593bcea682098a59b560c1850c19746e10/appveyor/run_with_env.cmd"


def install(local_path):
    """Download ``run_with_env.cmd`` and copy it to ``local_path``"""

    remote_script = urlopen(SCRIPT_URL)
    with open(local_path, "wb") as local_script:
        shutil.copyfileobj(remote_script, local_script)

if __name__ == '__main__':
    install(sys.argv[0])

@@ -98,16 +98,26 @@
 )%0A%0A%22%22%22%0A%0A
+import os%0A
 import s
@@ -392,16 +392,114 @@
 v.cmd%22%0A%0A
+LOCAL_PATH_DEFAULT = %5C%0A    os.path.join(os.path.dirname(__file__), %22run-with-visual-studio.cmd%22)%0A%0A
 %0Adef ins
@@ -513,16 +513,35 @@
 cal_path
+=LOCAL_PATH_DEFAULT
 ):%0A    %22
@@ -800,12 +800,12 @@
 ys.argv%5B
-0
+1
 %5D)%0A

Fix dowload destination path