merge curdir/pardir fix from Alexandre Conrad

This commit is contained in:
Carl Meyer 2010-04-13 02:59:43 -04:00
commit 9433c375fb
3 changed files with 36 additions and 3 deletions

View File

@ -189,6 +189,8 @@ def is_filename(name):
if (splitext(name)[1].lower() in ('.zip', '.tar.gz', '.tar.bz2', '.tgz', '.tar', '.pybundle')
and os.path.exists(name)):
return True
if name in (os.path.curdir, os.path.pardir):
return True
if os.path.sep not in name and '/' not in name:
# Doesn't have any path components, probably a requirement like 'Foo'
return False

View File

@ -1,5 +1,4 @@
from os.path import abspath, join, dirname, pardir
from os.path import abspath, join, dirname, curdir, pardir
from test_pip import here, reset_env, run_pip, pyversion, lib_py
def test_correct_pip_version():
@ -147,3 +146,35 @@ def test_vcs_url_urlquote_normalization():
result = run_pip('install', '-e', 'bzr+http://bazaar.launchpad.net/~django-wikiapp/django-wikiapp/release-0.1#egg=django-wikiapp', expect_error=True)
assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
def test_install_from_local_directory():
"""
Test installing from a local directory.
"""
reset_env()
to_install = abspath(join(here, 'packages', 'FSPkg'))
result = run_pip('install', to_install, expect_error=False)
assert (lib_py + 'site-packages/fspkg') in result.files_created, str(result.stdout)
assert (lib_py + 'site-packages/FSPkg-0.1dev-py%s.egg-info' % pyversion) in result.files_created, str(result)
def test_install_curdir():
"""
Test installing current directory ('.').
"""
reset_env()
run_from = abspath(join(here, 'packages', 'FSPkg'))
result = run_pip('install', curdir, cwd=run_from, expect_error=False)
assert (lib_py + 'site-packages/fspkg') in result.files_created, str(result.stdout)
assert (lib_py + 'site-packages/FSPkg-0.1dev-py%s.egg-info' % pyversion) in result.files_created, str(result)
def test_install_pardir():
"""
Test installing parent directory ('..').
"""
reset_env()
run_from = abspath(join(here, 'packages', 'FSPkg', 'fspkg'))
result = run_pip('install', pardir, cwd=run_from, expect_error=False)
assert (lib_py + 'site-packages/fspkg') in result.files_created, str(result.stdout)
assert (lib_py + 'site-packages/FSPkg-0.1dev-py%s.egg-info' % pyversion) in result.files_created, str(result)

View File

@ -41,7 +41,7 @@ def reset_env(environ=None):
environ = clear_environ(environ)
environ['PIP_DOWNLOAD_CACHE'] = download_cache
environ['PIP_NO_INPUT'] = '1'
environ['PIP_LOG_FILE'] = './pip-log.txt'
environ['PIP_LOG_FILE'] = os.path.join(base_path, 'pip-log.txt')
env = TestFileEnvironment(base_path, ignore_hidden=False, environ=environ)
env.run(sys.executable, '-m', 'virtualenv', '--no-site-packages', env.base_path)