Created
May 13, 2014 00:50
-
-
Save Ivoz/d9bff05069e0ec53e6ea to your computer and use it in GitHub Desktop.
bash script to reproduce https://github.com/pypa/pip/issues/3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Reproduce namespace / editable install problem with pip | |
# https://github.com/pypa/pip/issues/3 | |
# cleanup from previous invocations | |
foos=('foo-main' 'foo-client' 'foo-env') | |
rm -rf -- "${foos[@]}" | |
echo "Creating foo package..." | |
mkdir -p foo-main/foo | |
echo "__import__('pkg_resources').declare_namespace('foo')" > foo-main/foo/__init__.py | |
echo " | |
def thing(): | |
return 'hello!' | |
" > foo-main/foo/run.py | |
echo " | |
from setuptools import setup, find_packages | |
setup(name='foo', | |
version='0.1.0', | |
author='PyPA', | |
author_email='[email protected]', | |
url='https://github.com/pypa', | |
license='MIT', | |
packages=find_packages(), | |
namespace_packages=['foo'], | |
zip_safe=False, | |
) | |
" > foo-main/setup.py | |
echo "Creating foo.client package..." | |
mkdir -p foo-client/foo/client | |
echo "__import__('pkg_resources').declare_namespace('foo')" > foo-client/foo/__init__.py | |
touch foo-client/foo/client/__init__.py | |
echo " | |
from foo.run import thing | |
def test(): | |
print(thing()) | |
" > foo-client/foo/client/bar.py | |
echo " | |
from setuptools import setup, find_packages | |
setup(name='foo.client', | |
version='0.1.0', | |
author='PyPA', | |
author_email='[email protected]', | |
url='https://github.com/pypa', | |
license='MIT', | |
packages=find_packages(), | |
namespace_packages=['foo'], | |
zip_safe=False, | |
) | |
" > foo-client/setup.py | |
echo "Creating virtualenv test environment..." | |
virtualenv -ppython2 foo-env | |
echo "Installing foo with pip normally..." | |
foo-env/bin/pip install ./foo-main/ | |
echo "Installing foo.client with pip in development..." | |
foo-env/bin/pip install -e ./foo-client/ | |
echo "running 'from foo.client import bar; bar.test()'..." | |
foo-env/bin/python -c "from foo.client import bar; bar.test()" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment