Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save legal90/8f810644b7e84f08cc033e147eea066e to your computer and use it in GitHub Desktop.
Save legal90/8f810644b7e84f08cc033e147eea066e to your computer and use it in GitHub Desktop.
omnibus-python-windows.rb
#
# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name "python-windows"
default_version "2.7.11"
license 'Python-2.0'
license_file 'LICENSE.txt'
version('2.7.13') { source :md5 => '268fd335aad649df7474adb13b6cf394' }
version('2.7.11') { source :md5 => '25acca42662d4b02682eee0df3f3446d' }
version('2.7.9') { source :md5 => '21ee51a9f44b7160cb6fc68e29a1ddd0' }
source :url => "https://www.python.org/ftp/python/#{version}/python-#{version}.amd64.msi"
target_path = "#{install_dir}/embedded/python"
# sadly, msiexec on win2k8 interprets any path with forward slashes in it as a network location
target_path.gsub!('/', '\\')
build do
command "msiexec /i python-#{version}.amd64.msi TARGETDIR=#{target_path} /qb"
# There exists no configure flag to tell Python to not compile sqlite3
# Remove sqlite3 libraries, if you want to include sqlite, create a new def
# in your software project and build it explicitly. This removes the adapter
# library from python, which links incorrectly to a system library. Adding
# your own sqlite definition will fix this.
delete "#{install_dir}/embedded/python/libs/_sqlite3.lib"
delete "#{install_dir}/embedded/python/Lib/sqlite3/"
delete "#{install_dir}/embedded/python/DLLs/sqlite3.dll"
# Remove unused extension which is known to make healthchecks fail on CentOS 6
delete "#{install_dir}/embedded/python/libs/_bsddb.lib"
delete "#{install_dir}/embedded/python/Lib/bsddb"
# Remove unused ncurses support
delete "#{install_dir}/embedded/python/Lib/curses"
# remove unused idle editor support which required TCL/TK
delete "#{install_dir}/embedded/python/Lib/idlelib"
delete "#{install_dir}/embedded/python/lib/python2.7/lib-tk"
delete "#{install_dir}/embedded/python/tcl"
delete "#{install_dir}/embedded/python/Lib/lib-tk"
delete "#{install_dir}/embedded/python/DLLs/tk85.dll"
delete "#{install_dir}/embedded/python/DLLs/tcl85.dll"
delete "#{install_dir}/embedded/python/DLLs/tclpip85.dll"
delete "#{install_dir}/embedded/python/libs/_tkinter.lib"
# these are graphical tools embedded in the python distro
# that we would never use and depend on TCL/TK
delete "#{install_dir}/embedded/python/Tools/pynche"
delete "#{install_dir}/embedded/python/Tools/webchecker"
# this is a performance profiling tool we do not use
delete "#{install_dir}/embedded/python/Lib/hotshot"
# we don't need the python documentation
delete "#{install_dir}/embedded/python/Doc"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment