Skip to content

Commit

Permalink
reduce "tools" path to "t" + default install dir is "WinPython"
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebig committed Apr 4, 2018
1 parent 41169d3 commit e3d74f0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
54 changes: 27 additions & 27 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def build_nsis(srcname, dstname, data):

class WinPythonDistribution(object):
"""WinPython distribution"""
MINGW32_PATH = r'\tools\mingw32\bin'
R_PATH = r'\tools\R\bin'
JULIA_PATH = r'\tools\Julia\bin'
NODEJS_PATH = r'\tools\n'
MINGW32_PATH = r'\t\mingw32\bin'
R_PATH = r'\t\R\bin'
JULIA_PATH = r'\t\Julia\bin'
NODEJS_PATH = r'\t\n'

def __init__(self, build_number, release_level, target, wheeldir,
toolsdirs=None, verbose=False, simulation=False,
Expand Down Expand Up @@ -134,15 +134,15 @@ def package_index_wiki(self):
def get_tool_path(relpath, checkfunc):
if self.simulation:
for dirname in self.toolsdirs:
path = dirname + relpath.replace(r'\tools', '')
path = dirname + relpath.replace(r'\t', '')
if checkfunc(path):
return path
else:
path = self.winpydir + relpath
if checkfunc(path):
return path

if get_tool_path (r'\tools\SciTE.exe', osp.isfile):
if get_tool_path (r'\t\SciTE.exe', osp.isfile):
installed_tools += [('SciTE', '3.3.7')]

rpath = get_tool_path(self.R_PATH, osp.isdir)
Expand All @@ -162,12 +162,12 @@ def get_tool_path(relpath, checkfunc):
npmver = utils.get_npmjs_version(nodepath)
installed_tools += [('npmjs', npmver)]

pandocexe = get_tool_path (r'\tools\pandoc.exe', osp.isfile)
pandocexe = get_tool_path (r'\t\pandoc.exe', osp.isfile)
if pandocexe is not None:
pandocver = utils.get_pandoc_version(osp.dirname(pandocexe))
installed_tools += [('Pandoc', pandocver)]

ffmpegexe = get_tool_path (r'\tools\ffmpeg.exe', osp.isfile)
ffmpegexe = get_tool_path (r'\t\ffmpeg.exe', osp.isfile)
if ffmpegexe is not None:
ffmpegver = utils.get_ffmpeg_version(osp.dirname(ffmpegexe))
installed_tools += [('ffmpeg', ffmpegver)]
Expand Down Expand Up @@ -241,7 +241,7 @@ def prepath(self):
"""Return PATH contents to be prepend to the environment variable"""
path = [r"Lib\site-packages\PyQt5", r"Lib\site-packages\PyQt4",
"", # Python root directory (python.exe)
"DLLs", "Scripts", r"..\tools", r"..\tools\mingw32\bin"
"DLLs", "Scripts", r"..\t", r"..\t\mingw32\bin"
]
if self.distribution.architecture == 32 \
and osp.isdir(self.winpydir + self.MINGW32_PATH):
Expand All @@ -264,13 +264,13 @@ def postpath(self):
"""Return PATH contents to be append to the environment variable"""
path = []
# if osp.isfile(self.winpydir + self.THG_PATH):
# path += [r"..\tools\TortoiseHg"]
# path += [r"..\t\TortoiseHg"]
return path

@property
def toolsdirs(self):
"""Return tools directory list"""
return [osp.join(osp.dirname(osp.abspath(__file__)), 'tools')] + self._toolsdirs
return [osp.join(osp.dirname(osp.abspath(__file__)), 't')] + self._toolsdirs

@property
def docsdirs(self):
Expand Down Expand Up @@ -473,15 +473,15 @@ def _install_all_other_packages(self):
def _copy_dev_tools(self):
"""Copy dev tools"""
self._print("Copying tools")
toolsdir = osp.join(self.winpydir, 'tools')
toolsdir = osp.join(self.winpydir, 't')
os.mkdir(toolsdir)
for dirname in self.toolsdirs:
for dirname in self.toolsdirs: # the ones in the make.py script environment
for name in os.listdir(dirname):
path = osp.join(dirname, name)
copy = shutil.copytree if osp.isdir(path) else shutil.copyfile
copy(path, osp.join(toolsdir, name))
if self.verbose:
print(path + ' --> ' + osp.join(toolsdir, name))
copy(path, osp.join(toolsdir, name))
self._print_done()

def _copy_dev_docs(self):
Expand Down Expand Up @@ -600,8 +600,8 @@ def _create_batch_scripts_initial(self):
rem ******************
rem handle R if included
rem ******************
if not exist "%WINPYDIRBASE%\tools\R\bin" goto r_bad
set R_HOME=%WINPYDIRBASE%\tools\R
if not exist "%WINPYDIRBASE%\t\R\bin" goto r_bad
set R_HOME=%WINPYDIRBASE%\t\R
if "%WINPYARCH%"=="WIN32" set R_HOMEbin=%R_HOME%\bin\i386
if not "%WINPYARCH%"=="WIN32" set R_HOMEbin=%R_HOME%\bin\x64
:r_bad
Expand All @@ -610,8 +610,8 @@ def _create_batch_scripts_initial(self):
rem ******************
rem handle Julia if included
rem ******************
if not exist "%WINPYDIRBASE%\tools\Julia\bin" goto julia_bad
set JULIA_HOME=%WINPYDIRBASE%\tools\Julia\bin\
if not exist "%WINPYDIRBASE%\t\Julia\bin" goto julia_bad
set JULIA_HOME=%WINPYDIRBASE%\t\Julia\bin\
set JULIA_EXE=julia.exe
set JULIA=%JULIA_HOME%%JULIA_EXE%
set JULIA_PKGDIR=%WINPYDIRBASE%\settings\.julia
Expand All @@ -620,8 +620,8 @@ def _create_batch_scripts_initial(self):
rem ******************
rem handle ffmpeg if included
rem ******************
if not exist "%WINPYDIRBASE%\tools\ffmpeg.exe" goto ffmpeg_bad
set IMAGEIO_FFMPEG_EXE=%WINPYDIRBASE%\tools\ffmpeg.exe
if not exist "%WINPYDIRBASE%\t\ffmpeg.exe" goto ffmpeg_bad
set IMAGEIO_FFMPEG_EXE=%WINPYDIRBASE%\t\ffmpeg.exe
:ffmpeg_bad
Expand Down Expand Up @@ -681,8 +681,8 @@ def _create_batch_scripts_initial(self):
#####################
### handle R if included
#####################
if (Test-Path "$env:WINPYDIR\..\tools\R\bin") {
$env:R_HOME = "$env:WINPYDIR\..\tools\R"
if (Test-Path "$env:WINPYDIR\..\t\R\bin") {
$env:R_HOME = "$env:WINPYDIR\..\t\R"
$env:R_HOMEbin = "$env:R_HOME\bin\x64"
if ("$env:WINPYARCH" -eq "WIN32") {
$env:R_HOMEbin = "$env:R_HOME\bin\i386"
Expand All @@ -692,8 +692,8 @@ def _create_batch_scripts_initial(self):
#####################
### handle Julia if included
#####################
if (Test-Path "$env:WINPYDIR\..\tools\Julia\bin") {
$env:JULIA_HOME = "$env:WINPYDIR\..\tools\Julia\bin\"
if (Test-Path "$env:WINPYDIR\..\t\Julia\bin") {
$env:JULIA_HOME = "$env:WINPYDIR\..\t\Julia\bin\"
$env:JULIA_EXE = "julia.exe"
$env:JULIA = "$env:JULIA_HOME$env:JULIA_EXE"
$env:JULIA_PKGDIR = "$env:WINPYDIR\..\settings\.julia"
Expand All @@ -702,8 +702,8 @@ def _create_batch_scripts_initial(self):
#####################
### handle ffmpeg if included
#####################
if (Test-Path "$env:WINPYDIR\..\tools\ffmpeg.exe") {
$env:IMAGEIO_FFMPEG_EXE = "%WINPYDIRBASE%\tools\ffmpeg.exe"
if (Test-Path "$env:WINPYDIR\..\t\ffmpeg.exe") {
$env:IMAGEIO_FFMPEG_EXE = "%WINPYDIRBASE%\t\ffmpeg.exe"
}
#####################
Expand Down Expand Up @@ -1370,6 +1370,6 @@ def make_all(build_number, release_level, pyver, architecture,
install_options=r'--no-index --pre --trusted-host=None',
find_links=r'D:\Winpython\packages.srcreq',
source_dirs=r'D:\WinPython\basedir34\packages.src D:\WinPython\basedir34\packages.win-amd64',
toolsdirs=r'D:\WinPython\basedir34\Tools.Slim',
toolsdirs=r'D:\WinPython\basedir34\t.Slim',
docsdirs=r'D:\WinPython\basedir34\docs.Slim'
)
5 changes: 3 additions & 2 deletions portable/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Licensed under the terms of the MIT License
;================================================================

!define ID "WinPython"
!define ID_INSTALL "WinPy"
!define ID_INSTALL "WinPython"
!define FILE_DESCRIPTION "${ID} Installer"
!define COMPANY "${ID}"
!define BRANDING "${ID}, the portable Python Distribution for Scientists"
Expand All @@ -43,7 +43,8 @@ OutFile "${DISTDIR}\..\${ID}${ARCH}-${VERSION}${RELEASELEVEL}.exe"
;InstallDir "$EXEDIR\${ID}${ARCH}-${VERSION}${RELEASELEVEL}"
; 2018-04-04 need to minimize path length of installation further: remove arch + flavor
;InstallDir "$EXEDIR\${ID_INSTALL}${ARCH}-${VERSION}${RELEASELEVEL}"
InstallDir "$EXEDIR\${ID_INSTALL}-${VERSION_INSTALL}${RELEASELEVEL}"
;InstallDir "$EXEDIR\${ID_INSTALL}-${VERSION_INSTALL}${RELEASELEVEL}"
InstallDir "$EXEDIR\${ID_INSTALL}"
BrandingText "${BRANDING}"
XPStyle on
RequestExecutionLevel user
Expand Down
4 changes: 2 additions & 2 deletions winpython/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


# Development only
TOOLS_DIR = osp.abspath(osp.join(osp.dirname(__file__), os.pardir, 'tools'))
TOOLS_DIR = osp.abspath(osp.join(osp.dirname(__file__), os.pardir, 't'))
if osp.isdir(TOOLS_DIR):
os.environ['PATH'] += ';%s' % TOOLS_DIR
ROOT_DIR = os.environ.get('WINPYTHONROOTDIR')
Expand Down Expand Up @@ -629,7 +629,7 @@ def do_script(this_script, python_exe=None, copy_to=None,


if __name__ == '__main__':
thg = get_thg_version(osp.join(BASE_DIR, 'tools', 'tortoisehg'))
thg = get_thg_version(osp.join(BASE_DIR, 't', 'tortoisehg'))
print(("thg version: %r" % thg))

print_box("Test")
Expand Down

0 comments on commit e3d74f0

Please sign in to comment.