distutils

How remove a program installed with distutils?

旧城冷巷雨未停 提交于 2020-01-22 14:54:05
问题 I have installed a python application with this setup.py: #!/usr/bin/env python from distutils.core import setup from libyouandme import APP_NAME, APP_DESCRIPTION, APP_VERSION, APP_AUTHORS, APP_HOMEPAGE, APP_LICENSE setup( name=APP_NAME.replace(" ","-").lower(), version=APP_VERSION, description=APP_DESCRIPTION, author="John G", author_email="xxx@gmail.com", url=APP_HOMEPAGE, license=APP_LICENSE, scripts=["youandme.py"], packages=["libyouandme"], data_files=[ ('share/applications', ['youandme

distutils: How to pass a user defined parameter to setup.py?

被刻印的时光 ゝ 提交于 2020-01-18 19:36:05
问题 Please prompt me how to pass a user-defined parameter both from the command line and setup.cfg configuration file to distutils' setup.py script. I want to write a setup.py script, which accepts my package specific parameters. For example: python setup.py install -foo myfoo Thank you, Mher 回答1: As Setuptools/Distuils are horribly documented, I had problems finding the answer to this myself. But eventually I stumbled across this example. Also, this similar question was helpful. Basically, a

Check some requirements when running setup.py for install

时光总嘲笑我的痴心妄想 提交于 2020-01-16 01:01:30
问题 I want to check some requirements (but existence of other python packages, I already know how to do that) of the system before running setup() , like check output of some system commands , to stop installation process and warn user if requirements doesn't met. But I need to do it only when running setup.py install , not setup.py check or setup.py sdist . How can I do that? UPD: Example of check that I need: packs = subprocess.check_output(['packagemanager', '--list']) if NAME in packs: print

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

拟墨画扇 提交于 2020-01-12 14:27:28
问题 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

Managing resources in a Python project

浪子不回头ぞ 提交于 2020-01-09 12:24:28
问题 I have a Python project in which I am using many non-code files. Currently these are all images, but I might use other kinds of files in the future. What would be a good scheme for storing and referencing these files? I considered just making a folder "resources" in the main directory, but there is a problem; Some images are used from within sub-packages of my project. Storing these images that way would lead to coupling, which is a disadvantage. Also, I need a way to access these files which

Inconsistent behaviour of bdist vs sdist when distributing a Python package

一笑奈何 提交于 2020-01-06 20:02:02
问题 I have a big project with the following structure. utilities is a collections of small modules that are reused in various places by the different components of the big_project , project1 , 2, etc. big_project/ |-- __init__.py |-- utilities/ |-- mod1.py |-- mod2.py |-- project1/ |-- setup.py |-- __init__.py |-- src/ |-- __init__.py |-- mod1.py |-- mod2.py |-- examples/ |-- __init__.py |-- mod.py |-- project2/ |-- ... |-- project3/ |-- ... I want to distribute project1 , including utilities

Distutils, older rpm, and customized spec file

孤者浪人 提交于 2020-01-05 08:42:37
问题 I finally got my program packaged in a RPM on Fedora 14 yesterday, and I thought that it would be easy to build it the same way on a CentOS 4.8 box. It turns out that the older version of rpm and distutils are severally limited, and I'm not having any luck working around it. The basic problem is that distutils with Python 2.7 supports an option called "--post-install" where I can specify a script. The script is included and is run when I install with yum or rpm. Everything is great. However,

Distutils, older rpm, and customized spec file

寵の児 提交于 2020-01-05 08:42:32
问题 I finally got my program packaged in a RPM on Fedora 14 yesterday, and I thought that it would be easy to build it the same way on a CentOS 4.8 box. It turns out that the older version of rpm and distutils are severally limited, and I'm not having any luck working around it. The basic problem is that distutils with Python 2.7 supports an option called "--post-install" where I can specify a script. The script is included and is run when I install with yum or rpm. Everything is great. However,

Distutils: build multiple Python extension modules (written in Swig) that share a method

倾然丶 夕夏残阳落幕 提交于 2020-01-05 04:28:09
问题 I have four C++ files: A.h, A.cpp, B.h, B.cpp, and A.h is included in B.cpp A.h: #pragma once void A(); A.cpp: #include <iostream> void A() { std::cout << "A" << std::endl; } B.h: #pragma once void B(); B.cpp: #include "A.h" #include <iostream> void B() { A(); std::cout << "B" << std::endl; } Now I wrote two SWIG inerface files A.i and B.i A.i: %module A %{ #include "A.h" %} %include "A.h" B.i: %module B %{ #include "B.h" %} %include "B.h" The setup.py file is: from distutils.core import

Python package with data files

久未见 提交于 2020-01-02 23:03:52
问题 A Python package should contain some data files alongside with Python sources. How to make setuptools or distutils to install the data files? How can my Python code know which directories my data files are installed in? 回答1: Following will answer your Q#1: There is a concept of data_file and package_data. Package_data is used to include documentation and data_files is used to include configuration file, messages and data file. 来源: https://stackoverflow.com/questions/48696115/python-package