[Distutils] a package with is a module

Marius Gedminas marius at pov.lt
Mon Oct 27 16:30:03 CET 2014


On Mon, Oct 27, 2014 at 06:47:45AM -0700, Ethan Furman wrote:
> If there is an answer, tutorial, readme, or docs that would help, a
> link would be greatly appreciated.
> 
> I have finally converted my dbf library to Python3, but I want to
> also continue supporting at least 2.7, and I see no reason to remove
> the existing library which also supports back to 2.4.

My objgraph is a single-file Python module that supports Pythons from
2.4 to 3.4. [*]

  [*] Well, it _probably_ supports 2.4 and 2.5; I don't actually test
      that because tox no longer supports 2.4 or 2.5 (and tox dropped
      support for those Pythons because virtualenv dropped support for
      them, IIRC).

> So I have multiple problems:
> 
>   - how do I tell PyPI that this file is for Python2.4 - 2.6, this
> other file is for 2.7, and this other other file is for 3.3+ ?

Maintaining three separate files is a pain.  Most people who support
multiple Python versions would recommend sticking to a single source
written in the common language subset.  It's not that hard.

http://python3porting.com/noconv.html has helpful suggestions.  If you
don't want to rely on the `six` module from PyPI, you can always copy
the tricks it performs and do them yourself.

>   - if I have to stick it all in one archive, how do I tell setup.py which to install?

Even if that's possible, I don't think it's a good idea.

>   - is it possible to have all three source files as, say, .txt
> files, and then have some Python code before the setup() call which
> renames the correct one to dbf.py?

If you go this route I suggest copying instead of renaming.

> How do I know where the .txt files are at to rename them?

Many setup.py files fail if you run them when your working directory is
not the one where the setup.py resides itself.  I think you can safely
rely on that implementation detail.

Marius Gedminas
-- 
If the facts don't fit the theory, change the facts.
                -- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20141027/8186149f/attachment-0001.sig>


More information about the Distutils-SIG mailing list