Skip to content

Instantly share code, notes, and snippets.

@jrast
Created December 7, 2015 09:48
Show Gist options
  • Save jrast/ae1e653b142a16d320d5 to your computer and use it in GitHub Desktop.
Save jrast/ae1e653b142a16d320d5 to your computer and use it in GitHub Desktop.
How To Make WinPython: Overhaul

How to make Winpython-201506 of August 2015

This procedure may help You doing your own Winpython-201506 of August 2015 distribution in about 2 hours. (multiply by 4, if you're taking the slow path)

Changelog

(v08, 2015-08-08):

  • we now use gcc Compiler provided by mingwpy wheel (same author as mingw64-static: Carl Kleffner, much simpler integration: a wheel)
  • we now use a dos batch script instead of runnin make.py interactively

(v07, 2015-03-01):

(v06, 2015-01-30):

  • replace old mingw32 reference per mingw64-static

(v05, 2014-12-20):

(v04b, 2014-10-18b):

  • winpython builder is to be used with a python 3.3+
  • adding nsis-2.46-strlen_8192.zip patch (to preserve existing %PATH% bigger than 1024 character)
  • use rather an existing Winpython 64 bit version to build a new one
  • how to do a flavor

Procedure

This Procedure is a rewrite or complement of the original method created by Pierre Raybaut (here)

It provides two optional big shortcuts over the original method :

  • not downloading yourself a set of packages, one by one,
  • not downloading yourself the additional tools.

Step 0 (optional): Install a md5/sh1 checker


(duration ~ 10')

for example the one from microsoft : "fciv.exe":

MD5 SHA-1 File
58dc4df814685a165f58037499c89e76 99fb35d97a5ee0df703f0cdd02f2d787d6741f65 windows-kb841290-x86-enu.exe
  • see its Readme
  • doing a small fciv_launcher.bat next to it may help: drag & drop the file to check over 'fciv_launcher.bat'
rem this is fciv_launcher.bat
"%~dp0fciv.exe" %1 -both>%1.hash.txt
notepad.exe %1.hash.txt

Step 1 (mandatory): Install the complementary external tools for building Winpython


(duration ~ 20')

optional :

mandatory :

  • the python building module "https://github.com/winpython/winpython",
  • 7zip (to install or to re-take from official site)
  • nsis (2.46) + 1 external module + the "8192 characters in PATH" patch

==> they are provided at https://sourceforge.net/projects/winpython/files/WinPython_Source/Do_It_Yourself/mandatory_to_install_tools/

==> or you can download them from their origin, as described below.

2014-10-18 complement

MD5 SHA-1 File
5e02441c7f3fa4da4f4928a2d42a07c3 1a0f9ec81b39da809cdc9495166a2a1c9a79719c nsis-2.46-setup.exe
2347d68b9579525f6fbcbdb4d93c596f 8ecc9deb4f233c6622f90ed30afacd890ec56ad0 textreplace.zip
441274c321383936860e845bd1eb4340 03c86e42464c6da82e0340acf807c88e3d1e40e0 7z922.exe
604c0c2c7902c5b6a1f89ab0b1f7a87c 1534fe63749009472c82f6bf960a7da7201dda06 nsis-2.46-strlen_8192.zip

Step 2 (mandatory): Install a version of winpython (or a standard python) on your PC


(duration ~ 15')

  • downloading for example winpython3.4.3.4 (or using one you have)
  • warning : Use a 64 bit winpython if you plan to create a 64 build with it
  • download WinPython-64bit-3.4.3.4.exe from sourceforge.net (or github release tag)
  • check its hash :
MD5 SHA-1 Binary
e275934df30b0831cad1849efd609e4f 07c3c29cf34a0f36b804685dd6d769921f95debc winpython-64bit-3.4.3.4.exe
6a45b8d3e1a36e31d5526adecbf655a4 fe28d0db8b84001cfc4bc5f45d87b63445942810 winpython-32bit-3.4.3.4.exe
fb6c256442079099e0fec5b37c49ca64 224e5f754c3e49c20458b4c560034d9c331ee190 winpython-64bit-3.3.5.0.exe
ccc8af61ae894a8fa052c49c8ecf2ad1 df5280fb911ca7d1ad09bcb089a98693b14e566e winpython-32bit-3.3.5.0.exe
  • let suppose you placed it in D:\WinPython-64bit-3.4.3.4 (or 'PC_WinPython_location')

Step 3 (mandatory):


(duration ~ 10' if you get what is proposed here and build winpython3.4, 4 hours if your download yourself)

Prepare the 'root' directory hierarchy to build your distribution

  • a root directory per major release is nice (or copy the old one elsewhere) :

    • D:\winpython , for this example
  • the a sub-directory according to your Python targets :

    • winpython\basedir27 (if you want to build for python 2.7)
    • winpython\basedir34 (if you want to build for python 3.4)
    • winpythonQt5\basedir34 (if you want to build a variant for python 3.4 with Qt5)
  • each basedir** subdirectory must contain the following subdirectories, for example

    • basedir34\packages.src
    • basedir34\packages.win32 (if you want to build for python 3.4 - 32bit)
    • basedir34\packages.win-amd64 (if you want to build for python 3.4 - 64bit)
    • build (initially empty, will contain the Winpython build you're creating before it's made into an installer)
    • tools
    • tools.win32 (if you want to build for python 3.4 - 32bit)
    • tools.win-amd64 (if you want to build for python 3.4 - 64bit)

==> the typical contain of these directories is provided as .zip, as it was for winpython (after) ".1" at https://sourceforge.net/projects/winpython/files/WinPython_Source/Do_It_Yourself/Winpython_2015-06/

==> unzip them "here", so you create the directory at the right level : basedir34\packages.win32\python-3.4.1.msi , ..

==> slow path (or when you will build your own), download them yourself from : https://pypi.python.org/pypi http://www.lfd.uci.edu/~gohlke/pythonlibs/ https://binstar.org/carlkl/mingwpy or other places


Step 5 (optional): Feeding tools, tools.win32, tools.win-amd64 yourself


(duration = 0' if you take them from your usual winpython, ~ 1 hour if you download yourself)

Since Winpython of 2015-08-09, we use mingwpy wheel for the compilation toolchain. ==> Download mingwpy0.1.0b3 (or better) wheels from https://binstar.org/carlkl/mingwpy/files ==> Manage it like any other wheel.

MD5 SHA-1 Binary
b25141aaf75b2bc0532bfa6ae1f5664c a5d3493f2acd7a5e0e7cdf15e84e22aa557cec1b mingwpy-0.1.0b3-cp27-none-win_amd64.whl
1e06cbf74b9acd6fe2ba3f0815cdf436 cdbbfa7a9eabbe8c2538b053bf17d315d2cf409c mingwpy-0.1.0b3-cp27-none-win32.whl
2f85adc0a37fee0af938620b0418db7a 337ff9ce348cf73dca0ee69b5be0a23e82b4b59c mingwpy-0.1.0b3-cp34-none-win_amd64.whl
f067f48fcf685d0d6dd4587a0f4280fe 80553ad13797e160dbcfe240a2e6ac002f366174 mingwpy-0.1.0b3-cp34-none-win32.whl

Step 4 (mandatory): The building moment


(duration ~ 30')

  • unzip "winpython" source code (taken from github) to (for example) d:\winpython-builder (for example from https://github.com/winpython/winpython/releases/tag/1.2.20150809) (so that, for example, you have a dos file in D:\winpython-builder\generate_winpython_distros34.bat)
  • edit 'generate_winpython_distros34.bat' :
    • set my_buildenv to the root directory of your existing Winpython, that will be used to build new ones
rem this replace running manually from spyder the make.py 
rem to launch from a winpython module 'make' directory 

set my_original_path=%path%
set my_buildenv=D:\WinPython-64bit-3.4.3.3_b0

set my_root_dir_for_builds=D:\Winpython
set my_python_target=34
set my_pyver=3.4
set my_release=5

set my_arch=64
set my_preclear_build_directory=Yes
 
call %~dp0\generate_a_winpython_distro.bat
  • save it, double_click on it and wait about 40',
    • result :
      • a directory basedir34\build\WinPython-64bit-3.4.3.5 is created with your new Winpython in it (after 20')
      • a Winpython_installer will be create from it as basedir34\WinPython-64bit-3.4.3.5.exe (after 20' more)
    • when it works, start removing, upgrading, adding some packages, and do your own custom Winpython.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment