Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Various functions to install `TDM-GCC <http://tdm-gcc.tdragon.net/>`_.
4"""
5from __future__ import print_function
6import sys
7import os
8import re
10from .install_custom import download_page, download_from_sourceforge
13def install_tdm_gcc(dest_folder=".", fLOG=print, install=False, version=None):
14 """
15 install `TDM-GCC <http://tdm-gcc.tdragon.net/>`_ (only on Windows)
17 @param dest_folder where to download the setup
18 @param fLOG logging function
19 @param install install (otherwise only download)
20 @param version version to download (unused)
21 @return downloaded file
23 It should
24 ::
26 mingw-get install binutils gcc g++ mingw32 fortran gdb mingw32 mingw w32api g77==3.4.5
28 """
29 if version is not None:
30 raise ValueError("cannot specify a version")
31 if not sys.platform.startswith("win"):
32 raise NotImplementedError(
33 "TDM-GCC can only be installed on Windows at the moment")
35 url = "http://tdm-gcc.tdragon.net/download"
36 page = download_page(url, is406=True)
38 reg = re.compile(
39 "<a href=\\\"http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC[%]20Installer/(tdm64-.*?[.]exe)/download\\\"")
40 find = reg.findall(page)
41 if len(find) == 0:
42 raise Exception("unable to find the file to download at " +
43 url + "\nfound: " + str(len(find)) + "\n" + "\n".join(find))
44 name = find[0]
46 newurl = "http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/{0}/download?use_mirror=autoselect".format(
47 name)
48 outfile = os.path.join(dest_folder, name)
49 fLOG("[pymy] tdm-gcc, download from ", newurl)
50 file = download_from_sourceforge(
51 newurl,
52 outfile,
53 fLOG=fLOG,
54 temp_folder=dest_folder)
56 if install:
57 raise NotImplementedError()
58 return file