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 Function to start on Windows from scratch
5.. versionadded:: 1.1
6"""
7from __future__ import print_function
8import sys
9import os
10from ..win_installer.win_setup_main_helper import win_download, win_install
13def windows_default_tools_list():
14 """
15 returns a list of tools to install
17 @return list of tools
18 """
19 return ["7z", "scite", "putty", "mingw", "SQLiteSpy", "r", "vs",
20 "julia", "graphviz", "tdm", "pandoc",
21 "jdk", "jenkins",
22 "miktex", "inkscape",
23 "git", "python"]
26def windows_startup(destination, temp_folder, params=None, fLOG=print):
27 """
28 Installs many tools.
29 It does not work with Python 2.7.
31 @param destination destination
32 @param temp_folder temporary folder (not cleaned), for downloading purpose
33 @param fLOG logging function
34 @param params dictionary
35 @return operations (what was done)
37 About *params*, it can contains:
39 * *tools*: list of tools to install, see @see fn win_download, if None, use a default list defined
40 in @see fn windows_default_tools_list
42 .. exref::
43 :title: Setup a machine
45 The following code tries to download many tools and packages
46 to prepare a machine for a datascientist on Windows::
48 from pymyinstall.startup import windows_startup
49 windows_startup(r"d:\\datascientist", r"d:\\temp\\datascientist", fLOG=print)
51 .. versionadded:: 1.1
52 """
53 if sys.version_info[0] == 2:
54 raise SystemError("It requires Python 3+")
56 # creating folders if they don't exists
57 if not os.path.exists(destination):
58 os.makedirs(destination)
59 if not os.path.exists(temp_folder):
60 os.makedirs(temp_folder)
61 if params is None:
62 params = {}
64 # selection
65 tools = params.get("tools", None)
66 if tools is None:
67 tools = windows_default_tools_list()
69 if isinstance(tools, list):
70 tools = {k: None for k in tools}
72 fLOG("[pymy] ------ download", tools)
73 op = win_download(temp_folder, fLOG=fLOG, selection=tools, module_list=[])
75 # copy de SQLiteSpy, putty, Scite
76 names = ["Julia", "Scite", "7z", "TDM", "MinGW", "R", "pandoc",
77 "SQLiteSpy", "Putty", "Graphviz", "Jdk", "Jenkins", "Git",
78 "MikTex", "InkScape",
79 "Python", ]
81 fLOG("[pymy] ------ install", tools)
82 folders = dict(tools=destination,
83 python=os.path.join(destination, "python"))
84 op += win_install(folders, download_folder=temp_folder,
85 fLOG=fLOG, selection=tools, names=names)
86 return op