On 02/05/2014 09:27 AM, Sascha Peilicke wrote:
On Wednesday 05 February 2014 08:14:03 Robert Schweikert wrote:
On 02/04/2014 09:58 PM, Jason Craig wrote:
On 02/04/2014 02:46 PM, Robert Schweikert wrote:
Trying to create a package from source that has no setup.py. THus to keep things simple I figured I'd create one myself ;) . But that's not working out the way I figured it would, thus I could use a hint or two.
The source tree has packages in the lib directory, i.e. lib/a lib/b lib/c exist. The problem now is that some of these are dependencies that are already packaged. For simplicty lets say I am only interested in installing b.
Thus in my setup.py file I have
setuptools.setup(
..... .... packages=setuptools.find_packages('lib', exclude=['a','c']), package_dir={'': 'lib'}
)
Based on the info that I found the "exclude" argument should tell find_packages to not consider those packages and this works. When running in an active session and printing the results of find_packages I get only stuff in "b".
However when I run setup.py I still get "a" and "c" installed in the target directory :(
When you say "when I run setup.py" do you mean you are calling
python setup.py build
Ooops, sorry should have been more specific, I run
-> python setup.py install --prefix=/usr --root=/work/tmp/testInstall
Then /work/tmp/testInstall/usr/lib/python2.7/site-packages/
contains a, b, and c, much to my dismay.
and then you are looking in the "build" directory and seeing that the folders "lib/a" and "lib/c" still exist there? If that is the case, you can run "python setup.py clean --all" to remove the build directory and start fresh. The build command won't remove those folders if they already exist in the build output. Also, for some reason the clean command without the --all flag doesn't remove the build directory, only some "temporary files" which is unclear to me what that actually means.
I think your packages and package_dir parameters are good for what you are trying to do.
I guess I'll have to invent some other code in setup.py to isolate b from its dependencies. Grmbl.
Either specifying all (sub-)modules directly:
packages=["b"],
or the setuptools-lazy-bunch way:
packages=find_packages(exclude=["a","c"]),
will work. Your mistake seems to be the (first positional) argument. It's not needed (and could be redundant with packages_dir), check http://pythonhosted.org/setuptools/setuptools.html#using-find-packages.
Hmm, dropping the "lib" from findpackages() resulted in nothing being installed. I guess the tools don't really support what simple interpretation would think they do. I'll write some code that finagles the directory structure, ugh do I hate this. Thanks, Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead Public Cloud Architect rjschwei@suse.com rschweik@ca.ibm.com 781-464-8147 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org