distutils

setup.py check if non-python library dependency exists

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 07:29:01
I'm trying to make a setup.py for cgal-bindings . To install this, the user needs to have at least a certain version of CGAL. In addition, CGAL has a few optional targets that should be built if the user has some libraries (like Eigen3). Is there a cross-platform way in Python to check for this? I can use find_library in ctypes.util to check if the library exists, but I don't see any easy way to get the version . <-- This doesn't actually work all the time, some libraries are header-only like eigen3, which is a C++ template library. Using the install_requires argument of setup() only works for

Setuptools not passing arguments for entry_points

天大地大妈咪最大 提交于 2019-12-04 05:20:27
I'm using setuptools for a Python script I wrote After installing, I do: $ megazord -i input -d database -v xx-xx -w yy-yy Like I would if I was running it ./like_this However, I get: Traceback (most recent call last): File "/usr/local/bin/megazord", line 9, in <module> load_entry_point('megazord==1.0.0', 'console_scripts', 'megazord')() TypeError: main() takes exactly 1 argument (0 given) Which looks like setuptools is not sending my arguments to main() to be parsed (by optparse) Here's my setuptools config for entry_points: entry_points = { 'console_scripts': [ 'megazord = megazord.megazord

Using Sphinx with a distutils-built C extension

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 04:53:17
I have written a Python module including a submodule written in C: the module itself is called foo and the C part is foo._bar . The structure looks like: src/ foo/__init__.py <- contains the public stuff foo/_bar/bar.c <- the C extension doc/ <- Sphinx configuration conf.py ... foo/__init__.py imports _bar to augment it, and the useful stuff is exposed in the foo module. This works fine when it's built, but obviously won't work in uncompiled form, since _bar doesn't exist until it's built. I'd like to use Sphinx to document the project, and use the autodoc extension on the foo module. This

Installing my sdist from PyPI puts the files in unexpected places

梦想与她 提交于 2019-12-04 04:44:04
My problem is that when I upload my Python package to PyPI, and then install it from there using pip, my app breaks because it installs my files into completely different locations than when I simply install the exact same package from a local sdist. Installing from the local sdist puts files on my system like this: /Python27/ Lib/ site-packages/ gloopy-0.1.alpha-py2.7.egg/ (egg and install info files) data/ (images and shader source) doc/ (html) examples/ (.py scripts that use the library) gloopy/ (source) This is much as I'd expect, and works fine (e.g. my source can find my data dir,

Python distutils gcc path

做~自己de王妃 提交于 2019-12-04 04:30:57
I'm trying to cross-compile the pycrypto package, and I'm getting closer and closer however, I've hit an issue I just can't figure out. I want distutils to use the cross-compile specific gcc- so I set the CC env var and it seems to respect the setting for the first invocation of the compiler, but thats it. export CC="/opt/teeos/buildroot/output/host/usr/bin/i586-linux-gcc" /opt/teeos/buildroot/output/host/usr/bin/i586-linux-gcc -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 --sysroot=/opt/teeos/buildroot/output/staging -I/opt/teeos/buildroot/output/staging/usr/include

Passing the library path as a command line argument to setup.py

落爺英雄遲暮 提交于 2019-12-04 02:56:54
modules = [Extension("MyLibrary", src, language = "c++", extra_compile_args=["-fopenmp", "-std=c++11", "-DNOLOG4CXX"], # log4cxx is not currently used extra_link_args=["-fopenmp", "-std=c++11"], include_dirs=[os.path.join(os.path.expanduser("~"), (os.path.join(gtest, "include"))], library_dirs=[log4cxx_library, os.path.join(os.path.expanduser("~"), gtest)], libraries=["log4cxx", "gtest"])] This is a part of my setup.py script. How do I pass options like include_dirs or library_dirs through command line arguments, so that path could be set up by the user? Think this may be what you're looking

Create launchable GUI script from Python setuptools (without console window!)

家住魔仙堡 提交于 2019-12-04 02:55:26
The way I currently add an executable for my Python-based GUI is this: setup( # ... entry_points = {"gui_scripts" : ['frontend = myfrontendmodule.launcher:main']}, # ... ) On Windows, this will create "frontend.exe" and "frontend-script.pyw" in Python's scripts folder (using Python 2.6). When I execute the EXE file, a console window is shown but the PYW file works correctly without showing one. So my question is: How can I make the EXE file execute the program without the console window? The solution should work on Linux, too (don't suggest py2exe ;). Alright, I investigated a bit in the

TypeError: dist must be a Distribution instance

半世苍凉 提交于 2019-12-04 02:42:31
My package depends on BeautifulSoup. If I install my package in a fresh virtualenv via python setup.py develop , I get the following error. If I execute python setup.py develop a second time, everything seems to work fine. I have no idea, what's happening. How to fix it to get a reproducable setup? Best match: beautifulsoup4 4.3.2 Downloading https://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.3.2.tar.gz#md5=b8d157a204d56512a4cc196e53e7d8ee Processing beautifulsoup4-4.3.2.tar.gz Writing /tmp/easy_install-1eBfi3/beautifulsoup4-4.3.2/setup.cfg Running beautifulsoup4-4.3.2

setup.py not installing data files

元气小坏坏 提交于 2019-12-03 22:42:56
I have a Python library that, in addition to regular Python modules, has some data files that need to go in /usr/local/lib/python2.7/dist-package/mylibrary. Unfortunately, I have been unable to convince setup.py to actually install the data files there. Note that this behaviour is under install - not sdist. Here is a slightly redacted version of setup.py module_list = list_of_files setup(name ='Modules', version ='1.33.7', description ='My Sweet Module', author ='PN', author_email ='email', url ='url', packages = ['my_module'], # I tried this. It got installed in /usr/my_module. Not ok. # data

Rename script file in distutils

随声附和 提交于 2019-12-03 22:29:36
I have a python script, myscript.py, which I wish to install using distutils: from distutils.core import setup setup(..., scripts=['myscript.py'], ...) I'd prefer if I could call the installed script using just myscript instead of typing myscript.py . This could be accomplished by renaming the file to just myscript but then a lot of editors etc. would no longer understand that it is a Python file. Is there some way to keep the old name, myscript.py but still install the file as myscript ? cweiske You might want to look at the setuptools that do this automatically for you; from http:/