distutils

How can I run a Makefile in setup.py?

南笙酒味 提交于 2019-12-03 02:18:04
问题 I need to compile ICU using it's own build mechanism. Therefore the question: How can I run a Makefile from setup.py ? Obviously, I only want it to run during the build process, not while installing. 回答1: The method I normally use is to override the command in question: from distutils.command.install import install as DistutilsInstall class MyInstall(DistutilsInstall): def run(self): do_pre_install_stuff() DistutilsInstall.run(self) do_post_install_stuff() ... setup(..., cmdclass={'install':

pip 10 and apt: how to avoid “Cannot uninstall X” errors for distutils packages

浪尽此生 提交于 2019-12-03 02:14:58
问题 I am dealing with a legacy Dockerfile. Here is a very simplified version of what I am dealing with: FROM ubuntu:14.04 RUN apt-get -y update && apt-get -y install \ python-pip \ python-numpy # ...and many other packages RUN pip install -U pip RUN pip install -r /tmp/requirements1.txt # includes e.g., numpy==1.13.0 RUN pip install -r /tmp/requirements2.txt RUN pip install -r /tmp/requirements3.txt First, several packages are installed using apt , and then several packages are installed using

Python Daemon Packaging Best Practices

孤人 提交于 2019-12-03 01:32:19
问题 I have a tool which I have written in python and generally should be run as a daemon. What are the best practices for packaging this tool for distribution, particularly how should settings files and the daemon executable/script be handled? Relatedly are there any common tools for setting up the daemon for running on boot as appropriate for the given platform (i.e. init scripts on linux, services on windows, launchd on os x)? 回答1: To answer one part of your question, there are no tools I know

Python distutils error: “[directory]… doesn't exist or not a regular file”

人走茶凉 提交于 2019-12-03 01:15:41
Let's take the following project layout: $ ls -R . .: package setup.py ./package: __init__.py dir file.dat module.py ./package/dir: tool1.dat tool2.dat And the following content for setup.py : $ cat setup.py from distutils.core import setup setup(name='pyproj', version='0.1', packages=[ 'package', ], package_data={ 'package': [ '*', 'dir/*', ], }, ) As you can see, I want to include all non-Python files in package/ and package/dir/ directories. However, running setup.py install would raise the following error: $ python setup.py install running install running build running build_py creating

Python 3.4: compile cython module for 64-bit windows

萝らか妹 提交于 2019-12-03 00:14:52
I have a .pyx module that I've been trying to compile for use with 64-bit python 3.4 on Windows through various means but with no success. After a lot of trial and error, it does compile with python setup.py build_ext --inplace --compiler=mingw32 but of course, that won't work with 64-bit python. With msvc as the compiler, the error is File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall raise ValueError(str(list(result.keys()))) ValueError: ['path'] Windows 7 Microsoft Windows SDK for Windows 7 and .NET Framework 4 installed There appears to be some Microsoft Visual

A simple Hello World setuptools package and installing it with pip

家住魔仙堡 提交于 2019-12-02 20:53:46
I'm having trouble figuring out how to install my package using setuptools, and I've tried reading the documentation on it and SO posts, but I can't get it to work properly. I'm trying to get a simple helloworld application to work. This is how far I got: helloworld.py: print("Hello, World!") README.txt: Hello, World! readme MANIFEST.in: recursive-include images *.gif setup.py: from setuptools import setup, find_packages setup( name='helloworld', version='0.1', license='BSD', author='gyeh', author_email='hello@world.com', url='http://www.hello.com', long_description="README.txt", packages=find

Python can't locate distutils_path on Mac OSX

谁说胖子不能爱 提交于 2019-12-02 19:05:07
I've been using virtualenv + pip for python development. I'm not sure what happened, but suddenly whenever I try to run a command-line tool or import libraries, I get this error message: Traceback (most recent call last): File "/Users/kyle/.virtualenvs/fj/bin/pip", line 4, in <module> import pkg_resources File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 698, in <module> the platform/python version defined at initialization are added. File "/Users/kyle/.virtualenvs/fj/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg

Using CMake with setup.py

不羁岁月 提交于 2019-12-02 18:19:42
For a project I build a C library and implict Python bindings (via GObject introspection) with CMake. I also want to distribute some Python helper modules using distutils. I am able to build and install the module with this CMakeLists.txt find_program(PYTHON "python") if (PYTHON) set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/module/__init__.py") set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build") configure_file(${SETUP_PY_IN} ${SETUP_PY}) add_custom_command(OUTPUT ${OUTPUT} COMMAND ${PYTHON}

Automatic version number both in setup.py (setuptools) AND source code?

送分小仙女□ 提交于 2019-12-02 17:54:30
SITUATION: I have a python library, which is controlled by git, and bundled with distutils/setuptools. And I want to automatically generate version number based on git tags, both for setup.py sdist and alike commands, and for the library itself. For the first task I can use git describe or alike solutions (see How can I get the version defined in setup.py (setuptools) in my package? ). And when, for example, I am in a tag '0.1' and call for 'setup.py sdist', I get 'mylib-0.1.tar.gz'; or 'mylib-0.1-3-abcd.tar.gz' if I altered the code after tagging. This is fine. THE PROBLEM IS: The problem

How to use Python distutils?

醉酒当歌 提交于 2019-12-02 17:34:16
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/ubuntu users, but I don't understand make/configure files. I've primarily been a web developer up until now. edit : Does anyone know of a project that uses distutils so I could see it in action and, you know, actually try building it? Here are a few useful links Ubuntu Python