Benny,

I have just refreshed my memory on GEPS 026.  We have a prototype for both distutils and packaging (distutils2).

1. distutils

This is currently in trunk and appears to work.  It uses the setup.py and MANIFEST.in files.  There is no need to delete the autotools files or rename the src directory.

a. To create a source distribution run:

python setup.py sdist

It creates a tar file in dist directory.  It also creates a MANIFEST file that contains files in distribution.

b. To build run:

python setup.py build

Files are created in build directory.

c. To install run:

python setup.py install

For testing it is convenient to install to a different root directory and disable execution of post-install mime processing.

python setup.py install --root ~/test --enable-packager-mode


2. packaging (distutils2)

The prototype for this is in the GEPS 026 branch.  It uses the setup.cfg and custom_setup.py files.  The src directory needs to be renamed to gramps in order for this to work.

After a couple of tweaks to the setup.cfg file I managed to get this working in trunk.

You will need to install distutils2 and the patch in bug #14651.

a. To create a source distribution run:

pysetup run sdist

b. To build run:

pysetup run build

This will fail without the patch (bug #14651).

c. To install run:

pysetup run install_dist

Testing is a pain because of a bug with --dry-run and a bug with --install-data.  I suggest using the --home option.

Also, I have not written an --enable-packager-mode option for distutils2 yet.

There is no prototype for setuptools.  The code has only been tested on Linux.  I expect problems with other OS, in particular with file paths.  Note:  some paths need to be OS independent, but others need to be in Unix format (used in distutils configuration).

More information for distutils2 can be found in the GEPS.  Let me know if you need any help.

Regards,

Nick.


On 20/09/12 19:20, Benny Malengier wrote:


2012/9/20 Nick Hall <nick__hall@hotmail.com>
Benny,

I was helping Rob.  He was working on distutils2 which we should be able to get working for Linux quite easily.

There are 3 python options:

1. distutils
2. setuptools
3. packaging (distutils2)

The most modern is packaging which should be included in the next python release, but is available for earlier versions.  It should include some of the useful features of setuptools.

These tools provide 3 main functions:

1. Source distribution.

Files for distribution can be specified in a manifest file, in a configuration file or by using a manifest builder.  I wrote a manifest builder for distutils2 to include all files under subversion control.  The problem with this is that different versions of subversion use different file formats.  If we want to use a manifest builder, then we will need to run a subversion command rather than looking at the file system.

At the moment I suggest using a manifest file.

2. Build.

We don't actually build anything, but do run some translation utility scripts in this phase.  In distutils2, hooks are provided to run custom scripts.  In distutils and setuptools, custom scripts can be run by sub-classing commands.

3. Installation.

Installation involves copying files to the appropriate locations. It is easy to specify where to install packages and package data. We did not fully investigate how to handle resources.

In disutils2, they introduced a concept of resources.  The idea was that you could specify a target such as {doc}.  This would be substituted for the location of documentation, which is OS dependent.  We may need to investigate how to define custom resource locations.


For more complex software, such as Gramps, distutils2 could do with some more work.  It is getting there, but not quickly.

I'll get working what we have so far for you.

Ok. I would suggest copying trunk over the gep 26 branch, and then continue. Or delete the branch keeping the disutils stuff, and remaking it from trunk.
Should it just work, we can merge it in trunk, and iron out remaining issues there.

Benny

Nick.



On 20/09/12 16:25, Benny Malengier wrote:
Nick,

With Rob gone, how to proceed with http://www.gramps-project.org/wiki/index.php?title=GEPS_026:_Replace_%27make%27_for_Gramps_build
Looking at that page, I don't see definite answers, more like a list of possible problems.
You were involved with Rob in this if I remember correctly. Is distutils2 the way to go?
If so, I would try to start that. I assume deleting all makefiles, and creating a setup.py is all that is needed. Then deciding if we need one or two packages (gramps/gen and rest).

Benny