Issue #17896: Move Windows external lib sources from .. to externals.
diff --git a/.gitignore b/.gitignore
index 1ff7d5e..7e06d3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,4 +43,5 @@
 tags
 .coverage
 coverage/
+externals/
 htmlcov/
diff --git a/.hgignore b/.hgignore
index d6c6c73..ed5be73 100644
--- a/.hgignore
+++ b/.hgignore
@@ -61,4 +61,5 @@
 PCbuild/Win32-temp-*
 .coverage
 coverage/
+externals/
 htmlcov/
diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py
index 49960c7..953dcd5 100644
--- a/Lib/lib-tk/FixTk.py
+++ b/Lib/lib-tk/FixTk.py
@@ -48,8 +48,8 @@
 
 prefix = os.path.join(sys.prefix,"tcl")
 if not os.path.exists(prefix):
-    # devdir/../tcltk/lib
-    prefix = os.path.join(sys.prefix, os.path.pardir, "tcltk", "lib")
+    # devdir/externals/tcltk/lib
+    prefix = os.path.join(sys.prefix, "externals", "tcltk", "lib")
     prefix = os.path.abspath(prefix)
 # if this does not exist, no further search is needed
 if os.path.exists(prefix):
diff --git a/Misc/NEWS b/Misc/NEWS
index c60917f..1da8970 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -307,6 +307,9 @@
 Windows
 -------
 
+- Issue #17896: The Windows build scripts now expect external library sources
+  to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``.
+
 - Issue #17717: The Windows build scripts now use a copy of NASM pulled from
   svn.python.org to build OpenSSL.
 
diff --git a/PCbuild/build_ssl.py b/PCbuild/build_ssl.py
index 53c7e35..3ba2483 100644
--- a/PCbuild/build_ssl.py
+++ b/PCbuild/build_ssl.py
@@ -69,7 +69,7 @@
     propfile = (os.path.join(os.path.dirname(__file__), 'pyproject.vsprops'))
     with open(propfile) as f:
         m = re.search('openssl-([^"]+)"', f.read())
-        return "..\..\openssl-"+m.group(1)
+        return "..\externals\openssl-"+m.group(1)
 
 
 def create_makefile64(makefile, m32):
diff --git a/PCbuild/pyproject.vsprops b/PCbuild/pyproject.vsprops
index 1c7cee7..aed2300 100644
--- a/PCbuild/pyproject.vsprops
+++ b/PCbuild/pyproject.vsprops
@@ -46,7 +46,7 @@
 	/>

 	<UserMacro

 		Name="externalsDir"

-		Value="..\.."

+		Value="..\externals"

 	/>

 	<UserMacro

 		Name="bsddb47Dir"

diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index a65926d..4d4c7da 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -112,9 +112,9 @@
     Wraps the Tk windowing system.  Unlike _bsddb and _sqlite3, there's no
     corresponding tcltk.vcproj-type project that builds Tcl/Tk from vcproj's
     within our pcbuild.sln, which means this module expects to find a
-    pre-built Tcl/Tk in either ..\..\tcltk for 32-bit or ..\..\tcltk64 for
-    64-bit (relative to this directory).  See below for instructions to build
-    Tcl/Tk.
+    pre-built Tcl/Tk in either ..\externals\tcltk for 32-bit or
+    ..\externals\tcltk64 for 64-bit (relative to this directory).  See below
+    for instructions to build Tcl/Tk.
 bz2
     Python wrapper for the libbz2 compression library.  Homepage
         http://sources.redhat.com/bzip2/
@@ -186,8 +186,8 @@
 
 This extracts all the external subprojects from http://svn.python.org/external
 via Subversion (so you'll need an svn.exe on your PATH) and places them in
-..\.. (relative to this directory).  The external(-amd64).bat scripts will
-also build a debug build of Tcl/Tk; there aren't any equivalent batch files
+..\externals (relative to this directory).  The external(-amd64).bat scripts
+will also build a debug build of Tcl/Tk; there aren't any equivalent batch files
 for building release versions of Tcl/Tk lying around in the Tools\buildbot
 directory.  If you need to build a release version of Tcl/Tk it isn't hard
 though, take a look at the relevant external(-amd64).bat file and find the
@@ -208,36 +208,6 @@
 _bsddb.vcproj and sqlite3.vcproj files, which will remove the need for
 Tcl/Tk to be built separately via a batch file.
 
-XXX trent.nelson 02-Apr-08:
-    Having the external subprojects in ..\.. relative to this directory is a
-    bit of a nuisance when you're working on py3k and trunk in parallel and
-    your directory layout mimics that of Python's subversion layout, e.g.:
-
-        C:\..\svn.python.org\projects\python\trunk
-        C:\..\svn.python.org\projects\python\branches\py3k
-        C:\..\svn.python.org\projects\python\branches\release25-maint
-
-    I'd like to change things so that external subprojects are fetched from
-    ..\external instead of ..\.., then provide some helper scripts or batch
-    files that would set up a new ..\external directory with svn checkouts of
-    the relevant branches in http://svn.python.org/projects/external/, or
-    alternatively, use junctions to link ..\external with a pre-existing
-    externals directory being used by another branch.  i.e. if I'm usually
-    working on trunk (and have previously created trunk\external via the
-    provided batch file), and want to do some work on py3k, I'd set up a
-    junction as follows (using the directory structure above as an example):
-
-        C:\..\python\trunk\external <- already exists and has built versions
-                                       of the external subprojects
-
-        C:\..\python\branches\py3k>linkd.exe external ..\..\trunk\external
-        Link created at: external
-
-    Only a slight tweak would be needed to the buildbots such that bots
-    building trunk and py3k could make use of the same facility.  (2.5.x
-    builds need to be kept separate as they're using Visual Studio 7.1.)
-/XXX trent.nelson 02-Apr-08
-
 Building for Itanium
 --------------------
 
diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat
index 9da1ed1..12ea6eb 100644
--- a/PCbuild/rt.bat
+++ b/PCbuild/rt.bat
@@ -38,7 +38,7 @@
 if "%1"=="-d" (set suffix=_d)    & shift & goto CheckOpts
 if "%1"=="-x64" (set prefix=amd64) & (set tcltk=tcltk64) & shift & goto CheckOpts
 
-PATH %PATH%;%~dp0..\..\%tcltk%\bin
+PATH %PATH%;%~dp0..\externals\%tcltk%\bin
 set exe=%prefix%\python%suffix%
 set cmd=%exe% %dashO% -Wd -3 -E -tt ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9
 if defined qmode goto Qmode
diff --git a/Tools/buildbot/external-common.bat b/Tools/buildbot/external-common.bat
index 7ca41a6..fb36c17 100644
--- a/Tools/buildbot/external-common.bat
+++ b/Tools/buildbot/external-common.bat
@@ -1,7 +1,8 @@
 @rem Common file shared between external.bat and external-amd64.bat.  Responsible for
-@rem fetching external components into the root\.. buildbot directories.
+@rem fetching external components into the root\externals directory.
 
-cd ..
+if not exist externals mkdir externals
+cd externals
 @rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment
 @rem the following, check it in, then check it out, comment it out, then check it back in.
 @rem if exist bzip2-1.0.6 rd /s/q bzip2-1.0.6