Commit 7de0c4db authored by Jason R. Coombs's avatar Jason R. Coombs

Merge Pull Request #97

parents 6281ff54 c6452472
......@@ -2,6 +2,18 @@
CHANGES
=======
----------
Unreleased
----------
* Issue #80, #209: Eggs that are downloaded for ``setup_requires``,
``test_requires``, etc. are now placed in a ``.eggs`` directory instead of
the package root directory. This is a better place for them as it doesn't
cause later phases of setuptools to think that the package is already
installed and then not install the package permanently in the environment
(See #209).
---
6.1
---
......
......@@ -14,7 +14,8 @@ from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
from setuptools.depends import Require
from setuptools.compat import basestring, PY2
from setuptools.compat import basestring, PY2, unicode
from setuptools import win32
import pkg_resources
def _get_unpatched(cls):
......@@ -305,6 +306,21 @@ class Distribution(_Distribution):
else:
self.convert_2to3_doctests = []
def get_egg_cache_dir(self):
egg_cache_dir = os.path.join(os.curdir, '.eggs')
if not os.path.exists(egg_cache_dir):
os.mkdir(egg_cache_dir)
win32.hide_file(unicode(egg_cache_dir))
readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt')
with open(readme_txt_filename, 'w') as f:
f.write('This directory contains eggs that were downloaded '
'by setuptools to build, test, and run plug-ins.\n\n')
f.write('This directory caches those eggs to prevent '
'repeated downloads.\n\n')
f.write('However, it is safe to delete this directory.\n\n')
return egg_cache_dir
def fetch_build_egg(self, req):
"""Fetch an egg needed for building"""
......@@ -328,8 +344,9 @@ class Distribution(_Distribution):
if 'find_links' in opts:
links = opts['find_links'][1].split() + links
opts['find_links'] = ('setup', links)
install_dir = self.get_egg_cache_dir()
cmd = easy_install(
dist, args=["x"], install_dir=os.curdir, exclude_scripts=True,
dist, args=["x"], install_dir=install_dir, exclude_scripts=True,
always_copy=False, build_directory=None, editable=False,
upgrade=False, multi_version=True, no_report=True, user=False
)
......
# From http://stackoverflow.com/questions/19622133/python-set-hide-attribute-on-folders-in-windows-os
import ctypes
def hide_file(path):
"""Sets the hidden attribute on a file or directory
`path` must be unicode; be careful that you escape backslashes or use raw
string literals - e.g.: `u'G:\\Dir\\folder1'` or `ur'G:\Dir\folder1'`.
"""
SetFileAttributesW = ctypes.windll.kernel32.SetFileAttributesW
FILE_ATTRIBUTE_HIDDEN = 0x02
ret = SetFileAttributesW(path, FILE_ATTRIBUTE_HIDDEN)
if not ret:
raise ctypes.WinError()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment