summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/1431.change.rst1
-rw-r--r--setuptools/command/easy_install.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/changelog.d/1431.change.rst b/changelog.d/1431.change.rst
new file mode 100644
index 00000000..a3848afa
--- /dev/null
+++ b/changelog.d/1431.change.rst
@@ -0,0 +1 @@
+In ``easy_install.check_site_dir``, ensure the installation directory exists.
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index abca1ae1..64ff0457 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -460,6 +460,12 @@ class easy_install(Command):
instdir = normalize_path(self.install_dir)
pth_file = os.path.join(instdir, 'easy-install.pth')
+ if not os.path.exists(instdir):
+ try:
+ os.makedirs(instdir)
+ except (OSError, IOError):
+ self.cant_write_to_target()
+
# Is it a configured, PYTHONPATH, implicit, or explicit site dir?
is_site_dir = instdir in self.all_site_dirs