Gerry Reno wrote:
Andrew Straw wrote:
Gerry Reno wrote:
So now everything is working on hardy except for the fact that stdeb
0.3
has to be modified to remove the --single-version-externally-managed
option. So can you just create a 0.3a version with this small change
and
that could go out to the repositories and be available by default to
everyone. There does not seem to be any impact that I can see in making
this change and since so many people create their own install classes
this would actually prevent conflicts.
I figured out what the reason for --single-version-externally-managed is
-- it is required for namespace packages to function properly. Thus, I
can't remove it, as doing so would be a regression.
However, if you create a patch I can apply against the old-stable branch
that makes this optional, (e.g. set in a similar way as the
--ignore-install-requires option), I can add that and make release
0.3.1.
Ok, I'll look at getting you a patch that removes the option.
Patch to utils.py in old-stable branch attached.
Note also that I'm very close to releasing 0.4, as the 0.3 line
has major problems with Jaunty and later.
Are you planning to submit a patch for the bdist_deb command? I could
include that, too.
Yes, I have something ready but I think the 'bdist_deb' command
belongs as a distutils patch. I created the command by subclassing the
distutils Command class. Maybe Tarek could comment on what might be
best here.
Here is my working 'bdist_deb' code verbatim from inside my setup.py:
(it could be more pythonic of course with less os.system commands but
it's working real well this way at least)
=================================================
# Copyright 2009 Gerry Reno.
# stdeb note:
# stdeb 0.3 needs its util.py modified to remove the install
# option "--single-version-externally-managed" otherwise
# if you have subclassed the distutils install class to
# create your own "install" class (rather common) you will
# get an "unrecognized option" error when using 'bdist_deb'.
# I had to make this change to stdeb in order to get stdeb to work
# on Ubuntu Hardy with a setup.py that defined its own install.
from distutils.core import Command
if sys.hexversion >= 0x020500F0:
import stdeb
elif sys.argv[1] == 'bdist_deb':
print sys.argv[1], "requires python >= 2.5"
raise SystemExit(1)
class bdist_deb(Command):
# creates .deb pkg from a .dsc file that is generated using stdeb module
# requires stdeb, dpkg-dev, build-essential, python-all-dev,
debhelper, python-support, fakeroot
#
# to add 'postinst' and friends just create a debian/ control
directory in the home directory of your
# application and add a file 'python-myapp.postinst' and it will be
run post package installation.
description = 'Create debian-style source (.dsc using stdeb module)
and binary (.deb) packages'
user_options = [ ('install-dir=', 'd', "directory to install the files
to"),
]
def initialize_options (self):
self.install_dir = None
self.outfiles = []
def finalize_options (self):
pass
def run(self):
import setuptools
import commands
# run a sub_command (gen .dsc source pkg using stdeb)
self.run_command('sdist_dsc')
# save current directory
setup_dir = os.getcwd()
# define system command to execute (find source pkg work tree)
syscmd = ['find', 'deb_dist', '-mindepth', '1', '-maxdepth', '1',
'-type', 'd',]
# execute system command and read output (execute and read output of
find cmd)
dsc_tree = strip(subprocess.Popen(syscmd,
stdout=subprocess.PIPE).communicate()[0]) # strip needed to remove CR
# use system command output (change directory to work tree)
os.chdir(dsc_tree)
# define system command to execute (gen .deb binary pkg)
syscmd = 'dpkg-buildpackage -rfakeroot -uc -us'
# execute system command
if os.system(syscmd) == 0:
print '.deb successfully created in deb_dist/'
else:
print 'problem creating .deb'
# (change directory back to setup dir)
os.chdir(setup_dir)
setup(name = name,
...
# add new bdist_deb command here
cmdclass = {
...
'bdist_deb' : bdist_deb,
...
},
...
)
=================================================
Regards,
Gerry
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig
953c953
< --no-compile --single-version-externally-managed \\
---
> --no-compile \\
959c959
< --no-compile --single-version-externally-managed --install-layout=deb \\
---
> --no-compile --install-layout=deb \\
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig