distutils

Using setuptools to install files to arbitrary locations

≡放荡痞女 提交于 2019-12-11 06:16:31
问题 Is there a way to install files to arbitrary locations with setuptools? I've used Data Files with setuptools before, but those are typically installed inside the package directory. I need to install a plugin file that will be located in the install directory of another application. 回答1: The data_files attribute will allow you to specify full paths. You could also do some shutil.copy magic in your setup.py, except don't. 回答2: It seems that setuptools has purposely made it difficult to install

top-level package handling with setuptools (or another python egg builder)

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:59:48
问题 I am writing a little python app. I want to be able to easily deploy the app. I know that python 2.6 will allow one to execute an egg directly if there is a main module at the egg's root. I actually have that working. The one kink is that when I try to use the argparse library, I cannot include the library in the egg without installing it into my source directory (or symlinking in the argparse.py into my source dir) since the argparse module is in the top-level package. If I install it into a

How do you get cimport to work in Cython?

♀尐吖头ヾ 提交于 2019-12-11 02:27:54
问题 I have a directory structure as so: /my_module init .py A/ __init__.py a.pyx B/ __init__.py b.pyx In b.pyx I want to cimport functions from A.a. A regular python import works, but a cimport always fails. Also, I'm compiling A/ and B/ separately because I couldn't figure out how to put a setup.py in the top module. Can anyone help here? 回答1: You have to create a cython declaration file, a . pxd It shall contain only declarations of classes and functions that you want to import. 来源: https:/

Can distutils perform a dependency check without installing?

自作多情 提交于 2019-12-10 17:34:14
问题 Is it possible to have distutils just run the python module dependency analysis (and possibly install missing modules) without actually installing the python module in question? I imagine a command as follows: ./setup.py check-dependencies that would report if any dependent modules are missing on the target system. 回答1: I think the closest you can get is: setup.py install -v -n which means to run a dry-run ( -n ) in verbose ( -v ) mode. You could also use the distuitls.dep_util module, it

distutils “not a regular file --skipped”

被刻印的时光 ゝ 提交于 2019-12-10 17:20:06
问题 I have a very simple setup: from distutils.core import setup setup(name='myscripts', description='my scripts', author='Ago', author_email='blah', version='0.1', packages=['myscripts'] ) myscripts folder consists of about 10 python files. Everthing works fine if I just execute my main.py file (executable, which uses those myscripts files). Now I try to do: python setup.py sdist But I get: running sdist warning: sdist: missing required meta-data: url reading manifest file 'MANIFEST' creating

Compiling Cython with C header files error

半城伤御伤魂 提交于 2019-12-10 17:13:09
问题 So I'm trying to wrap some C code with Cython. I read read applied Cython's tutorials on doing this (1, 2), but these tutorials do not say much on how to compile the code once you have wrapped it with Cython, and so I have an error saying it can't find my C code. First, my cython script ("calcRMSD.pyx"): import numpy as np cimport numpy as np cdef extern from "rsmd.h": double rmsd(int n, double* x, double* y) #rest of the code ommited The C code I am trying to wrap ("rmsd.h"): #include

What are the use cases for a Python distribution?

回眸只為那壹抹淺笑 提交于 2019-12-10 15:06:53
问题 I'm developing a distribution for the Python package I'm writing so I can post it on PyPI. It's my first time working with distutils, setuptools, distribute, pip, setup.py and all that and I'm struggling a bit with a learning curve that's quite a bit steeper than I anticipated :) I was having a little trouble getting some of my test data files to be included in the tarball by specifying them in the data_files parameter in setup.py until I came across a different post here that pointed me

How can I set log level used by distutils when using pip?

瘦欲@ 提交于 2019-12-10 14:53:35
问题 I'm trying to find out what's the reason of error: Unable to find vcvarsall.bat after pip install greenlet . I'd like to set log level used by distutils so that debug messages like log.debug("Unable to find productdir in registry") would get printed. After looking at def parse_command_line(self): I thought pip install --install-option="-vv" greenlet should work but it doesn't (verbosity is still 1). How can I do this? 回答1: The correct way is to use the --global-option="-vv" switch for pip

Is it safe to call `setup()` multiple times in a single `setup.py`?

半世苍凉 提交于 2019-12-10 14:35:08
问题 I am developing a package containing Cython extensions. According to https://github.com/pypa/pip/issues/1958 I shall use setup_requires and postpone import of Cython . The best solution I came up with is to call setup() twice in setup.py : ... # initial imports setup(setup_requires=['cython']) from Cython.Build import cythonize bar = Extension('foo.bar', sources = ['bar.pyx']) setup(name = 'foo', ... # parameters ext_modules = cythonize([bar]), ... # more parameters ) However I have a feeling

ImportError: No module named distutils

吃可爱长大的小学妹 提交于 2019-12-10 13:44:24
问题 Attempt to install psutils resulted a big headache... $ python -V Python 2.4.2 $ cat /etc/SuSE-release SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 4 $ cd psutil-2.1.1/ $ python setup.py install Traceback (most recent call last): File "setup.py", line 17, in ? from distutils.core import setup, Extension ImportError: No module named distutils.core Next - I try to install setuptools to use easy_install : $ which easy_install which: no easy_install $ cd ../setuptools-1.4/ $