Skip to content

Commit 53fdde9

Browse files
uranusjrindygreg
authored andcommitted
windows: use Strawberry Perl for build
This avoids requiring a pre-installed Perl and a custom environment variable.
1 parent 1c8d77c commit 53fdde9

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

README.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ To build a Python distribution for macOS::
5656

5757
To build a Python distribution for Windows x64::
5858

59-
# Install ActivePerl
6059
# From a Visual Studio 2017 x64 native tools command prompt:
61-
$ set PERL=c:\path\to\activeperl\bin\perl.exe
6260
$ py.exe build-windows.py
6361

6462
Requirements
@@ -87,9 +85,8 @@ exist, try running the installer. e.g.::
8785
Windows
8886
-------
8987

90-
Visual Studio 2017 (or later) is required.
91-
92-
ActivePerl must be installed.
88+
Visual Studio 2017 (or later) is required. A compatible Windows SDK is required
89+
(10.0.17763.0 as per CPython 3.7.2).
9390

9491
How It Works
9592
============

build-windows.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ def run():
5656

5757

5858
if __name__ == '__main__':
59-
if 'PERL' not in os.environ:
60-
print('PERL must point to a perl executable')
61-
sys.exit(1)
62-
6359
try:
6460
if 'PYBUILD_BOOTSTRAPPED' not in os.environ:
6561
bootstrap()

cpython-windows/build.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import subprocess
1313
import sys
1414
import tempfile
15+
import zipfile
1516

1617
from pythonbuild.downloads import (
1718
DOWNLOADS,
@@ -928,7 +929,6 @@ def build_openssl_for_arch(perl_path, arch: str, openssl_archive, nasm_archive,
928929
openssl_version = DOWNLOADS['openssl']['version']
929930
nasm_version = DOWNLOADS['nasm-windows-bin']['version']
930931

931-
932932
log('extracting %s to %s' % (openssl_archive, build_root))
933933
extract_tar_to_directory(openssl_archive, build_root)
934934
log('extracting %s to %s' % (nasm_archive, build_root))
@@ -1227,7 +1227,6 @@ def build_cpython(pgo=False):
12271227
# The python.props file keys off MSBUILD, so it needs to be set.
12281228
os.environ['MSBUILD'] = str(msbuild)
12291229

1230-
activeperl_installer = download_entry('activeperl', BUILD)
12311230
bzip2_archive = download_entry('bzip2', BUILD)
12321231
sqlite_archive = download_entry('sqlite', BUILD)
12331232
tk_bin_archive = download_entry('tk-windows-bin', BUILD, local_name='tk-windows-bin.tar.gz')
@@ -1373,6 +1372,15 @@ def build_cpython(pgo=False):
13731372
create_tar_from_directory(fh, td / 'out')
13741373

13751374

1375+
def fetch_strawberry_perl() -> pathlib.Path:
1376+
strawberryperl_zip = download_entry('strawberryperl', BUILD)
1377+
strawberryperl = BUILD / 'strawberry-perl'
1378+
strawberryperl.mkdir(exist_ok=True)
1379+
with zipfile.ZipFile(strawberryperl_zip) as zf:
1380+
zf.extractall(strawberryperl)
1381+
return strawberryperl
1382+
1383+
13761384
def main():
13771385
BUILD.mkdir(exist_ok=True)
13781386

@@ -1384,8 +1392,9 @@ def main():
13841392
# TODO need better dependency checking.
13851393
openssl_out = BUILD / 'openssl-windows.tar'
13861394
if not openssl_out.exists():
1395+
perl_path = fetch_strawberry_perl() / 'perl' / 'bin' / 'perl.exe'
13871396
LOG_PREFIX[0] = 'openssl'
1388-
build_openssl(pathlib.Path(os.environ['PERL']))
1397+
build_openssl(perl_path)
13891398

13901399
LOG_PREFIX[0] = 'cpython'
13911400
build_cpython()

pythonbuild/downloads.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

55
DOWNLOADS = {
6-
'activeperl': {
7-
'url': 'https://downloads.activestate.com/ActivePerl/releases/5.26.3.2603/ActivePerl-5.26.3.2603-MSWin32-x64-a95bce075.exe',
8-
'size': 22429768,
9-
'sha256': 'bbd88265ab6d0ceb5ec2a6cd9870b0e9cd35b0d9be7671df840b0f239726b28d',
10-
'version': '5.26.3.2603',
11-
},
126
# 6.0.19 is the last version licensed under the Sleepycat license.
137
'bdb': {
148
'url': 'https://ftp.tw.freebsd.org/distfiles/bdb/db-6.0.19.tar.gz',
@@ -225,6 +219,12 @@
225219
'version': '3260000',
226220
'actual_version': '3.26.0.0',
227221
},
222+
'strawberryperl': {
223+
'url': 'http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip',
224+
'size': 143242779,
225+
'sha256': '8b15c7c9574989568254a7859e473b7d5f68a1145d2e4418036600a81b13805c',
226+
'version': '5.28.1.1',
227+
},
228228
'tcl': {
229229
'url': 'https://prdownloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz',
230230
'size': 10000896,

0 commit comments

Comments
 (0)