[Distutils] virtualenv & pypi-server
Andrea Crotti
andrea.crotti.0 at gmail.com
Thu Oct 27 15:12:59 CEST 2011
On 10/26/2011 03:19 PM, PJ Eby wrote:
> Why would you need that?
>
> As long as the eggs are present in a sys.path directory, the normal
> pkg_resources machinery will find them.
>
> If you mean you want to be able to test installation and deployment,
> or you are continually rebuilding your install directory for some
> other reason, then once again you don't need a PyPI server - just put
> all the eggs in a directory somewhere and use the --find-links (-f)
> option to easy_install to specify that directory name. It will then
> copy them from there.
>
I was convinced that I needed to add every egg to the sys.path to be
able to import it, well if I don't
actually need the local pypi-server than even better...
I was, however, doing some experiments, and not figuring out how it works.
I created an egg_directory where I added the mock library egg, I wanted to
see if I was able to find it, and that's what I do.
from pkg_resources import working_set, Environment, Requirement
from os.path import abspath
env = Environment(abspath('egg_directory'))
env.scan()
r = Requirement.parse('mock')
print(working_set.find(r))
It actually finds something but my USER installed version, not the local
version
in the subdirectory.
And from my understanding of the doc it should not even look for in the
global
sys.path, am I doing something wrong?
More information about the Distutils-SIG
mailing list