Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88337 > unrolled thread

Setuptools Confusion

Started byRob Gaddi <rgaddi@technologyhighland.invalid>
First post2015-03-30 18:11 +0000
Last post2015-03-31 06:03 +1100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Setuptools Confusion Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-03-30 18:11 +0000
    Re: Setuptools Confusion Ben Finney <ben+python@benfinney.id.au> - 2015-03-31 06:03 +1100

#88337 — Setuptools Confusion

FromRob Gaddi <rgaddi@technologyhighland.invalid>
Date2015-03-30 18:11 +0000
SubjectSetuptools Confusion
Message-ID<mfc3k8$ih7$2@dont-email.me>
I'm having two issues trying to make setuptools do what I want to package 
up an application.  Well, actually I'm having many issues, but I'll start 
with the two that are foremost right now.

First, I've got documentation in RestructuredText format that I want to 
cook down to HTML to include in with the application.  I've got a 
make_docs.py that I can run to do that.  I want to make sure that 
make_docs is run prior to building the sdist package so that the docs in 
the package are always up to date.  I have no idea how to do that.

Secondly, I'm using QSettings to manage my application data, and would 
like to create an .INI file (complete with comments and whatnot) in the 
correct system-dependent location.  Once again, I've got a function 
already written that does this.  I tried the only thing I could find on 
StackOverflow, which was to overwrite the install method with:

from setuptools.command.install import install as _install

# Post-install hook
class post_install(_install):
    def run(self):
        _install.run(self)
        from V120B.configuration import writeini
        writeini()

setup(
    ...
    # Use the post-install hook to provide the default .INI file.
    cmdclass={
        'install' : post_install
    },
)

But I don't see the file getting created.  Also, does this mean I'd also 
have to hook develop separately?

I feel like both my questions come down to the same root; how do I hook 
setuptools to do additional tasks at appropriate times?  Is it really as 
complicated as all this, or is there something trivial and stupid that 
I'm just missing?

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.

[toc] | [next] | [standalone]


#88340

FromBen Finney <ben+python@benfinney.id.au>
Date2015-03-31 06:03 +1100
Message-ID<mailman.345.1427742188.10327.python-list@python.org>
In reply to#88337
Rob Gaddi <rgaddi@technologyhighland.invalid> writes:

> I'm having two issues trying to make setuptools do what I want to package 
> up an application.

Those questions are on-topic here. It's worth noting, though, that you
may get better discussion of this by asking in the Distutils forum
<URL:https://www.python.org/community/sigs/current/distutils-sig/>.

> I feel like both my questions come down to the same root; how do I hook 
> setuptools to do additional tasks at appropriate times?

In short, you need to extend the ‘distutils.command’ classes and specify
your custom classes as commands. The Distutils documentation describes
this <URL:https://docs.python.org/3/distutils/extending.html>.

Note, though, that this is an advanced topic and not to be undertaken
lightly; it isn't very well understood.

> Is it really as complicated as all this, or is there something trivial
> and stupid that I'm just missing?

It's more complicated than you thought :-(

The Python Packaging Authority <URL:https://www.pypa.io/> has greatly
improved the situation in recent years, with the Python Packaging User
Guide <URL:https://packaging.python.org/> among other works.

The bad news is that, though better than ten years ago, Python package
distribution is still surprisingly baroque and difficult to navigate.

-- 
 \       “I never forget a face, but in your case I'll be glad to make |
  `\                                      an exception.” —Groucho Marx |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web