I have an open-ended question about the idea of creating two setup
scripts for a project: one for end-users (e.g. installing), and
another for all other use cases (e.g. project development).
Here are a few reasons I came across for considering something like this:
The first is that if the project needs to support, say, Python 2.4
through Python 3.2, then having two setup scripts would let you
require (and develop against) Python 2.7 for the developer version,
while supporting all versions only for the simpler end-user version.
This would also let you do things like import from the project itself
in the developer version of your setup script, a process that would
break if running the setup script using Python 3 (assuming you are
using 2to3 for Python 3 support).
The second is that I have a pre-processing step that requires using
pandoc to generate setup()'s long_description from README and HISTORY
files in markdown format prior to uploading to PyPI, and I don't want
end-users to need pandoc. I am currently dealing with this in code,
but it would be nicer to have simpler code with fewer "if blocks."
The third is simply separation of concerns.
This approach raises the following questions:
(1) Which setup commands should each version of the script support?
(2) Which arguments to setup() are required and/or used for each command?
I would also like to know (2) independent of creating two setup
scripts. For example, I mentioned long_description above. The
long_description seems to be available in places like PKG-INFO and in
the DOAP xml file exposed on PyPI, so is it necessary to pass
long_description, etc to setup() for any setup command other than
sdist (which creates PKG-INFO), or is it also necessary to pass that
metadata to setup() even with the upload and install commands?
Thanks,
--Chris
My take on installing entry_points.txt is to add a {dist-info}
category in [files] resources = to copy extra files into the
.dist-info dir...
How do I write entry_points.txt when it is given as an argument to
setup(entry_points=...)? Should I write a build command hook to write
the file and a setup_hook to append the new file to [files] resources
= so it will finally be copied?
I installed some time ago on MacOS X Lion the python-setuptools script
with the shell command
*/$ sudo sh setuptools-0.6c11-py2.7.egg/*
then I uninstalled any .egg installed and removed the script itself with
/*$ sudo easy_install -m setuptools*
/which in turn removed the /easy_install.pth /file//in the
//Library/Python/2.7/site-packages// directory. Now by running the
command /ls/ in that directory i get :
*/README
setuptools.pth
vboxapi-1.0-py2.7.egg-info
setuptools-0.6c11-py2.7.egg
vboxapi//*
can i remove /setuptools.pth and //setuptools-0.6c11-py2.7.egg /too ?
I'd like also to perform a total clean uninstallation so i searched in
my HD and i found that i still have the files :
*//usr/bin/easy_install
/usr/bin/easy_install-2.5
/usr/bin/easy_install-2.6
/usr/bin/easy_install-2.7 /*
and the following directories (i attach the output in a text file). I
also installed python-numpy through it and then uninstalled the package
itself in the standard way.
Which directories and files can i delete without harming my system (so i
can totally switch to macports) ? Thx in advance.
Regards, Arturo
Greetings:
Do you know if the command_hooks patch will get into Python-3.3.0a3
before the end of next week when it is suppose to be released?
I truly hope so because I am stuck because command hooks are not
working for me??? I hope that I am NOT being too pushy as I know that
Eric is go busy already!
--
Sincerely yours,
Rob G. Healey
Hello,
I found this email from some years ago:
http://mail.python.org/pipermail/distutils-sig/2009-September/013284.html
I find myself now having the same problems. My lazy solution so far
has been to simply install the data files into the same module
directory, and then I just do os.path.join(os.path.dirname(__file__),
'datafile.txt') when I want to access a data file.
This was ok when I only had one data file, but my project is expanding
and I need something more robust and organized. I tried to look at
other projects similar to mine to see how they handled this situation,
and it turns out that none of them use distutils! They are all using
autotools, and while that's a very cumbersome set of tools, it allows
them to pre-process the source files so that the source files know
where they've been installed to in a very straightforward way.
So I'm just wondering, is this build_py override still the best way to
accomplish this? Has this functionality been rolled into distutils in
the last 3 years? How are folks handling this situation now-a-days?
Note that I don't use setuptools so I'm looking for a pure-distutils solution.
Thanks!
--
http://exolucere.ca
So, I'm using distutils to build RPMs on Fedora. I've had success with
this in the past but now I'm running into a problem and I'm not sure
how to fix it since the error message is an outright lie!
I start like this, naturally:
$ python setup.py bdist_rpm
running bdist_rpm
writing 'build/bdist.linux-x86_64/rpm/SPECS/GottenGeography.spec'
running sdist
running check
warning: sdist: standard file not found: should have one of README, README.txt
reading manifest template 'MANIFEST.in'
not writing to manually maintained manifest file 'MANIFEST'
creating GottenGeography-1.0.1
creating GottenGeography-1.0.1/data
creating GottenGeography-1.0.1/gg
creating GottenGeography-1.0.1/po
making hard links in GottenGeography-1.0.1...
hard linking README.md -> GottenGeography-1.0.1
[.... blah blah blah ....]
Creating tar archive
removing 'GottenGeography-1.0.1' (and everything under it)
copying dist/GottenGeography-1.0.1.tar.gz ->
build/bdist.linux-x86_64/rpm/SOURCES
building RPMs
rpm: build/bdist.linux-x86_64/rpm/SPECS/GottenGeography.spec: No such
file or directory
error: Failed to execute: "rpm -q --qf
'%{name}-%{version}-%{release}.src.rpm
%{arch}/%{name}-%{version}-%{release}.%{arch}.rpm\\n' --specfile
'build/bdist.linux-x86_64/rpm/SPECS/GottenGeography.spec'"
And it just stops right there. Note that the very second line of
output indicates that it is creating this file. Indeed:
$ ls -lh build/bdist.linux-x86_64/rpm/SPECS/GottenGeography.spec
-rw-r--r--. 1 robru robru 1.3K May 3 02:04
build/bdist.linux-x86_64/rpm/SPECS/GottenGeography.spec
The file is there, with exactly the indicated path.
What is going wrong here? Google has turned up nothing, although it is
admittedly very difficult to search for since "No such file or
directory" is a very common error message and there's not a lot else
to go on here.
The only thing I can think of is that there's a distutils dependency
that I don't have installed, as this computer is a fresh install since
the last time this worked for me. But rpm and distutils are both
installed so I'm not really sure what exactly could be missing.
Help? Thanks.
--
http://exolucere.ca
So, I'm using distutils with some success lately, and I've borrowed
some code that extends install_data to compile .po (translation) files
into .mo files to be used by the system to display the translated
strings. It looks like this:
https://github.com/robru/gottengeography/blob/master/setup.py
It seems fairly straightforward to me and there's only a tiny amount
of magic involved.
However, upon testing this, I've discovered this behavior:
1. When running `setup.py install`, the mo files are correctly
compiled and installed to the system.
2. When running `setup.py bdist`, the resulting tarball will correctly
compile and include the mo files for distribution.
3. When running `setup.py bdist_rpm`, the resulting RPM file does not
contain any trace of any .po or .mo files.
I'm not sure why bdist_rpm is the odd man out here, but it seems like
I'm overlooking something simple. Unfortunately the API reference
seems a little light on details:
http://docs.python.org/distutils/apiref.html#module-distutils.command.bdist
So I'm not entirely clear on how I should go about overriding
bdist_rpm to achieve the same thing as is done by overriding
install_data. At this point I am reviewing the distutils source code
directly but it's been less instructive than I'd hoped.
Any ideas?
Thanks.
--
http://exolucere.ca
I am having issues in running easy_install in a sandbox environment
(chroot with python2.7 under FreeBSD 9.0-RELASE, without /dev mount).
easy_install is sourcing tempfile, which requires /dev/urandom to be
present, as seen in the backtrace:
brahm# sh -x setuptools-0.6c11-py2.7.egg
+ basename setuptools-0.6c11-py2.7.egg
+ [ setuptools-0.6c11-py2.7.egg = setuptools-0.6c11-py2.7.egg ]
+ exec python2.7 -c 'import sys, os; sys.path.insert(0,
os.path.abspath('\''setuptools-0.6c11-py2.7.egg'\'')); from
setuptools.command.easy_install import bootstrap;
sys.exit(bootstrap())'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py",
line 12, in <module>
File "/usr/local/lib/python2.7/tempfile.py", line 34, in <module>
from random import Random as _Random
File "/usr/local/lib/python2.7/random.py", line 881, in <module>
_inst = Random()
File "/usr/local/lib/python2.7/random.py", line 97, in __init__
self.seed(x)
File "/usr/local/lib/python2.7/random.py", line 111, in seed
a = long(_hexlify(_urandom(16)), 16)
OSError: [Errno 2] No such file or directory: '/dev/urandom'
Quite some time ago, their has been comments in the changelog (06.c4)
stating that running easy_install without /dev/urandom should be
possible:
Fixed not allowing os.open() of paths outside the sandbox, even if
they are opened read-only (e.g. reading /dev/urandom for random
numbers, as is done by os.urandom() on some platforms).
While this was back in 2006, I was wondering what the current state of
affairs which regards of requiring the /dev/urandom as of today? Am I
looking at a feature request, bug report or design limitation?
Br. /Rick
--
http://rickvanderzwet.nl
Hi all,
The Montreal-Python user group is organizing a second sprint to work
on distutils2 on May 12th. If you live in Montreal, take a laptop and
come join us! No previous knowledge of Distutils2 is required, just
general Python skills. All details are found here:
http://montrealpython.org/2012/05/distutils2-sprint-2/
Cheers