Python distribution utilities (distutils) in trunk

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Python distribution utilities (distutils) in trunk

Nick Hall-6
Devs,

I have committed some code to test the python distribution utilities
(distutils) in trunk.  Both autotools and distutils can be used at the
same time.

To create a source distribution (in the dist directory):

python setup.py sdist

To build language files and man pages (in the build directory):

python setup.py build

To test an installation I suggest installing to a directory beneath your
home directory:

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

(The --enable-packager-mode option will prevent the post-installation
scripts running.)

At the moment the code should work for Linux, but I expect it to fail
for MacOS and Windows.  If the initial testing is successful then we can
move enhance the code for MacOS and Windows.

The code in GEPS026 is for testing distutils2 (packaging in python 3).

Let us know what you think.

Regards,

Nick.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

John Ralls-2

On May 19, 2012, at 4:19 PM, Nick Hall wrote:

> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>

Nice. Works great on a Mac, except for one wee niggle:
bash: /Volumes/SSD/Gramps-Build/gramps-svn/inst/bin/gramps: Permission denied

chmod a+x fixed it, of course.

Regards,
John Ralls

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

robhealey1
Dear John:

I am extremely glad that it worked for you and the MacOS !  Would the problem be with the gramps startup script???

It would be nice to fix it in the original setup file...

Sincerely yours,
Rob G. Healey


On Sat, May 19, 2012 at 6:02 PM, John Ralls <[hidden email]> wrote:

On May 19, 2012, at 4:19 PM, Nick Hall wrote:

> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>

Nice. Works great on a Mac, except for one wee niggle:
bash: /Volumes/SSD/Gramps-Build/gramps-svn/inst/bin/gramps: Permission denied

chmod a+x fixed it, of course.

Regards,
John Ralls

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



--
Sincerely yours,
Rob G. Healey



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

robhealey1
Greetings:

This problem has been resolved in rev19604 ...

Please let me know if you are still having any other problems?

Thank you for being willing to try it out...

Sincerely yours,
Rob G. Healey


On Sat, May 19, 2012 at 10:45 PM, Rob Healey <[hidden email]> wrote:
Dear John:

I am extremely glad that it worked for you and the MacOS !  Would the problem be with the gramps startup script???

It would be nice to fix it in the original setup file...

Sincerely yours,
Rob G. Healey



On Sat, May 19, 2012 at 6:02 PM, John Ralls <[hidden email]> wrote:

On May 19, 2012, at 4:19 PM, Nick Hall wrote:

> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>

Nice. Works great on a Mac, except for one wee niggle:
bash: /Volumes/SSD/Gramps-Build/gramps-svn/inst/bin/gramps: Permission denied

chmod a+x fixed it, of course.

Regards,
John Ralls

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



--
Sincerely yours,
Rob G. Healey





--
Sincerely yours,
Rob G. Healey



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
Rob,

I have tidied up the code setting permissions.  Instead of setting the permissions of the shell script to 775, I now effectively do a chmod a+rx.

I have also removed 'chmod -R 777 build'.

Nick.


On 20/05/12 14:02, Rob Healey wrote:
Greetings:

This problem has been resolved in rev19604 ...

Please let me know if you are still having any other problems?

Thank you for being willing to try it out...

Sincerely yours,
Rob G. Healey


On Sat, May 19, 2012 at 10:45 PM, Rob Healey <[hidden email]> wrote:
Dear John:

I am extremely glad that it worked for you and the MacOS !  Would the problem be with the gramps startup script???

It would be nice to fix it in the original setup file...

Sincerely yours,
Rob G. Healey



On Sat, May 19, 2012 at 6:02 PM, John Ralls <[hidden email]> wrote:

On May 19, 2012, at 4:19 PM, Nick Hall wrote:

> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>

Nice. Works great on a Mac, except for one wee niggle:
bash: /Volumes/SSD/Gramps-Build/gramps-svn/inst/bin/gramps: Permission denied

chmod a+x fixed it, of course.

Regards,
John Ralls

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



--
Sincerely yours,
Rob G. Healey





--
Sincerely yours,
Rob G. Healey




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
In reply to this post by John Ralls-2
John,

It looks like we should be able to get it working for the Mac quite easily.

Where should we install the files in the mac directory?

At the moment we install some resource files for Linux.  Should we do
this for the Mac?  If so, are they being copied to the correct
locations?  (By default prefix=/usr/local).

These files are translated and the '.in' extension removed before
installation:

data/gramps.desktop.in -> ${prefix}/share/applications
data/gramps.keys.in ->${prefix}/ share/mime-info
data/gramps.xml.in -> ${prefix}/share/mime/packages

These files are just copied:

data/gramps.mime -> ${prefix}/share/mime-info
data/*.png  -> ${prefix}/share/icons/gnome/48x48/mimetypes
data/*.svg -> ${prefix}/share/icons/gnome/scalable/mimetypes
src/images/gramps.png -> ${prefix}/share/icons
'AUTHORS', 'COPYING', 'FAQ', 'INSTALL', 'NEWS', 'README', 'TODO' ->
${prefix}/share/doc/gramps
example/gedcom/* -> ${prefix}/share/doc/gramps/example/gedcom
example/gramps/* -> ${prefix}/share/doc/gramps/example/gramps

All compiled language files are installed in:

${prefix}/share/locale/<language>/LC_MESSAGES

and manual files in:

${prefix}/share/man/<language>/man1

(where <language> is a language code for all supported languages)

Thanks for looking at this.

Regards,

Nick.


On 20/05/12 02:02, John Ralls wrote:

> On May 19, 2012, at 4:19 PM, Nick Hall wrote:
>
>> Devs,
>>
>> I have committed some code to test the python distribution utilities
>> (distutils) in trunk.  Both autotools and distutils can be used at the
>> same time.
>>
>> To create a source distribution (in the dist directory):
>>
>> python setup.py sdist
>>
>> To build language files and man pages (in the build directory):
>>
>> python setup.py build
>>
>> To test an installation I suggest installing to a directory beneath your
>> home directory:
>>
>> python setup.py install --root ~/install_test --enable-packager-mode
>>
>> (The --enable-packager-mode option will prevent the post-installation
>> scripts running.)
>>
>> At the moment the code should work for Linux, but I expect it to fail
>> for MacOS and Windows.  If the initial testing is successful then we can
>> move enhance the code for MacOS and Windows.
>>
>> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>>
>> Let us know what you think.
>>
> Nice. Works great on a Mac, except for one wee niggle:
> bash: /Volumes/SSD/Gramps-Build/gramps-svn/inst/bin/gramps: Permission denied
>
> chmod a+x fixed it, of course.
>
> Regards,
> John Ralls
>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

jerome
In reply to this post by Nick Hall-6
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

# Remove directories which should not be included in the distribution
prune src/guiQML
prune src/webapp
+prune src/gen/db/test
+prune src/gen/lib/test
+prune src/gen/utils/test
+prune src/Merge/test
+prune src/test
+prune po/test
+prune test


Maybe a class for removing previous installed versions, is missing?

I know it is the metadata stuff, but even cosmetic into a common active
branch, this becomes very annoying when upgrading to a new major release
without removing previous installed files (files paths, clean
installation, conflicts or mistakes on plugins names, etc ...)

Anyway, these are very cosmetic issues against this this nice working
alternate
'build/install' way. :)

==Installation ==

* A 'makefile.am' remains into example/gramps directory (out of /src).

* The 'splash.jpg' file is missing
14666: ERROR: gramps.py: line 178: Unhandled exception
Traceback (most recent call last):
   File
"install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/viewmanager.py",
line 1816, in display_about_box
     about = GrampsAboutDialog(self.uistate.window)
   File
"install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/aboutdialog.py",
line 114, in __init__
     self.set_logo(gtk.gdk.pixbuf_new_from_file(const.SPLASH))
GError: Impossible d'ouvrir le fichier
« install_test/usr/local/lib/python2.6/dist-packages/gramps/images/splash.jpg » :
Aucun fichier ou dossier de ce type

> "The code in GEPS026 is for testing distutils2 (packaging in python 3)."

I have planned to test it too, but had no time yet...


Thank you Rob and Nick!

Jérôme


Nick Hall a écrit :

> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>
> Regards,
>
> Nick.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

robhealey1
Dear Jerome:

On Sun, May 20, 2012 at 7:42 AM, Jérôme <[hidden email]> wrote:
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

I agree with part of this, but not all of it!  Benny Malengier said that he wants all of the test directories included!

He also sad that src/guiQML is NOT to be added!

Doug S. Blank said that, since Gramps-Connect will be separaly packaged, NOT to include it!
In this separate package, he said that these directories will need to be included also:
src/webapp
src/plugins/webstuff
src/data/templates

These directories will need to be moved into the web server directory:
/var/www/html

It will also need to be checked for the httpd package if it is installed or not first?

Sincerely yours,
Rob G. Healey


# Remove directories which should not be included in the distribution
prune src/guiQML
prune src/webapp
+prune src/gen/db/test
+prune src/gen/lib/test
+prune src/gen/utils/test
+prune src/Merge/test
+prune src/test
+prune po/test
+prune test


Maybe a class for removing previous installed versions, is missing?

I know it is the metadata stuff, but even cosmetic into a common active
branch, this becomes very annoying when upgrading to a new major release
without removing previous installed files (files paths, clean
installation, conflicts or mistakes on plugins names, etc ...)

Anyway, these are very cosmetic issues against this this nice working
alternate
'build/install' way. :)

==Installation ==

* A 'makefile.am' remains into example/gramps directory (out of /src).

* The 'splash.jpg' file is missing
14666: ERROR: gramps.py: line 178: Unhandled exception
Traceback (most recent call last):
  File
"install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/viewmanager.py",
line 1816, in display_about_box
    about = GrampsAboutDialog(self.uistate.window)
  File
"install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/aboutdialog.py",
line 114, in __init__
    self.set_logo(gtk.gdk.pixbuf_new_from_file(const.SPLASH))
GError: Impossible d'ouvrir le fichier
« install_test/usr/local/lib/python2.6/dist-packages/gramps/images/splash.jpg » :
Aucun fichier ou dossier de ce type

> "The code in GEPS026 is for testing distutils2 (packaging in python 3)."

I have planned to test it too, but had no time yet...


Thank you Rob and Nick!

Jérôme


Nick Hall a écrit :
> Devs,
>
> I have committed some code to test the python distribution utilities
> (distutils) in trunk.  Both autotools and distutils can be used at the
> same time.
>
> To create a source distribution (in the dist directory):
>
> python setup.py sdist
>
> To build language files and man pages (in the build directory):
>
> python setup.py build
>
> To test an installation I suggest installing to a directory beneath your
> home directory:
>
> python setup.py install --root ~/install_test --enable-packager-mode
>
> (The --enable-packager-mode option will prevent the post-installation
> scripts running.)
>
> At the moment the code should work for Linux, but I expect it to fail
> for MacOS and Windows.  If the initial testing is successful then we can
> move enhance the code for MacOS and Windows.
>
> The code in GEPS026 is for testing distutils2 (packaging in python 3).
>
> Let us know what you think.
>
> Regards,
>
> Nick.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



--
Sincerely yours,
Rob G. Healey



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

DS Blank
On Sun, May 20, 2012 at 3:17 PM, Rob Healey <[hidden email]> wrote:

> Doug S. Blank said that, since Gramps-Connect will be separaly packaged, NOT
> to include it!
> In this separate package, he said that these directories will need to be
> included also:
> src/webapp
> src/plugins/webstuff
> src/data/templates
>
> These directories will need to be moved into the web server directory:
> /var/www/html
>
> It will also need to be checked for the httpd package if it is installed or
> not first?

I would suggest that packagers build gramps-connect as a separate
package, with a dependency on the correct version of gramps.

There are many variations for installing and running a Django
application, but I think it would be a fine idea to make a package
that runs under the simplest manner: running under Apache with
mod_wsgi, with the sqlite3 database backend, and some statically
served files. I don't know how much a distro packaging system is
connected to distutils, but I'd be glad to help put this all together.

Requirements: Apache, Django, mod_wsgi (for Apache), sqlite3, and
gramps. I have a couple of files and some permission setting changes,
and then people will be able to run their own gramps-connect. Serious
use with distributed databases, load balancing, etc. are possible, but
beyond where we probably want to go with a default installer.

-Doug

>
> Sincerely yours,
> Rob G. Healey
>
>>
>> # Remove directories which should not be included in the distribution
>> prune src/guiQML
>> prune src/webapp
>> +prune src/gen/db/test
>> +prune src/gen/lib/test
>> +prune src/gen/utils/test
>> +prune src/Merge/test
>> +prune src/test
>> +prune po/test
>> +prune test
>>
>>
>> Maybe a class for removing previous installed versions, is missing?
>>
>> I know it is the metadata stuff, but even cosmetic into a common active
>> branch, this becomes very annoying when upgrading to a new major release
>> without removing previous installed files (files paths, clean
>> installation, conflicts or mistakes on plugins names, etc ...)
>>
>> Anyway, these are very cosmetic issues against this this nice working
>> alternate
>> 'build/install' way. :)
>>
>> ==Installation ==
>>
>> * A 'makefile.am' remains into example/gramps directory (out of /src).
>>
>> * The 'splash.jpg' file is missing
>> 14666: ERROR: gramps.py: line 178: Unhandled exception
>> Traceback (most recent call last):
>>   File
>>
>> "install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/viewmanager.py",
>> line 1816, in display_about_box
>>     about = GrampsAboutDialog(self.uistate.window)
>>   File
>>
>> "install_test/usr/local/lib/python2.6/dist-packages/gramps/gui/aboutdialog.py",
>> line 114, in __init__
>>     self.set_logo(gtk.gdk.pixbuf_new_from_file(const.SPLASH))
>> GError: Impossible d'ouvrir le fichier
>> «
>> install_test/usr/local/lib/python2.6/dist-packages/gramps/images/splash.jpg
>> » :
>> Aucun fichier ou dossier de ce type
>>
>> > "The code in GEPS026 is for testing distutils2 (packaging in python 3)."
>>
>> I have planned to test it too, but had no time yet...
>>
>>
>> Thank you Rob and Nick!
>>
>> Jérôme
>>
>>
>> Nick Hall a écrit :
>> > Devs,
>> >
>> > I have committed some code to test the python distribution utilities
>> > (distutils) in trunk.  Both autotools and distutils can be used at the
>> > same time.
>> >
>> > To create a source distribution (in the dist directory):
>> >
>> > python setup.py sdist
>> >
>> > To build language files and man pages (in the build directory):
>> >
>> > python setup.py build
>> >
>> > To test an installation I suggest installing to a directory beneath your
>> > home directory:
>> >
>> > python setup.py install --root ~/install_test --enable-packager-mode
>> >
>> > (The --enable-packager-mode option will prevent the post-installation
>> > scripts running.)
>> >
>> > At the moment the code should work for Linux, but I expect it to fail
>> > for MacOS and Windows.  If the initial testing is successful then we can
>> > move enhance the code for MacOS and Windows.
>> >
>> > The code in GEPS026 is for testing distutils2 (packaging in python 3).
>> >
>> > Let us know what you think.
>> >
>> > Regards,
>> >
>> > Nick.
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Live Security Virtual Conference
>> > Exclusive live event will cover all the ways today's security and
>> > threat landscape has changed and how IT managers can respond.
>> > Discussions
>> > will include endpoint security, mobile security and the latest in
>> > malware
>> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> > _______________________________________________
>> > Gramps-devel mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/gramps-devel
>> >
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Gramps-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>
>
>
> --
> Sincerely yours,
> Rob G. Healey
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

John Ralls-2
In reply to this post by Nick Hall-6

On May 20, 2012, at 7:21 AM, Nick Hall wrote:

> John,
>
> It looks like we should be able to get it working for the Mac quite easily.
>
> Where should we install the files in the mac directory?
>
> At the moment we install some resource files for Linux.  Should we do this for the Mac?  If so, are they being copied to the correct locations?  (By default prefix=/usr/local).
>
> These files are translated and the '.in' extension removed before installation:
>
> data/gramps.desktop.in -> ${prefix}/share/applications
> data/gramps.keys.in ->${prefix}/ share/mime-info
> data/gramps.xml.in -> ${prefix}/share/mime/packages
>
> These files are just copied:
>
> data/gramps.mime -> ${prefix}/share/mime-info
> data/*.png  -> ${prefix}/share/icons/gnome/48x48/mimetypes
> data/*.svg -> ${prefix}/share/icons/gnome/scalable/mimetypes
> src/images/gramps.png -> ${prefix}/share/icons
> 'AUTHORS', 'COPYING', 'FAQ', 'INSTALL', 'NEWS', 'README', 'TODO' -> ${prefix}/share/doc/gramps
> example/gedcom/* -> ${prefix}/share/doc/gramps/example/gedcom
> example/gramps/* -> ${prefix}/share/doc/gramps/example/gramps
>
> All compiled language files are installed in:
>
> ${prefix}/share/locale/<language>/LC_MESSAGES
>
> and manual files in:
>
> ${prefix}/share/man/<language>/man1
>
> (where <language> is a language code for all supported languages)
>

Nick,

Yeah, pretty easily: It already works.

Both MacPorts and Gtk-OSX build a standard unix-style installation. MacPorts sets prefix to /opt/local (I don't know *how* they do that; maybe Tim Lyons does) and Gtk-OSX allows it to be configured to whatever the user likes -- an important feature for me, because I have a dozen different build trees set up for various purposes. Jhbuild, which is what provides the basis for Gtk-OSX understands distutils, so it just worked (except for the one permissions problem, which probably affected Linux as well).

Building the application bundle is a separate step using a tool called gtk-mac-bundler. It understands the Unix directory layout and moves it into the appropriate places in the bundle (for the most part, it recreates the same directory structure under Gramps.app/Contents/Resources.

The locations of the resource files is fine. There's one additional resource file that you can copy over if you like: mac/gramps.accel, which can go to ${prefix}/share/gramps/data. It changes the menu accelerators (^C and ^V for copy and paste) to the Mac-standard ones.

Regards,
John Ralls


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Benny Malengier
In reply to this post by robhealey1


2012/5/20 Rob Healey <[hidden email]>
Dear Jerome:

On Sun, May 20, 2012 at 7:42 AM, Jérôme <[hidden email]> wrote:
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

I agree with part of this, but not all of it!  Benny Malengier said that he wants all of the test directories included!

Indeed. If you have a test framework, you should give the user who installed your code the option to run the tests and verify the library is working on their computer.
Obviously this is only possible if the test directories are part of the tests.

It is common to include in the README how the tests can be run from the command line. So once we install gramps in dist-packages, the line would be something like:

To test gramps is working as expected, you can run the testsuite with the command

python -c 'import gramps; gramps.test();'
 
Above assumes import gramps makes a test function available.
For the gramps-connect code, that would then install in a gramps-connect folder, and gramps connect can use code like:

from gramps.gen.lib import PrimaryObject

For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.

Benny


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Brian Matherly
>For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.


Should be consider splitting the code into three different "projects"?

1) Gramps Core - The gen.lib and all general core code
2) Gramps GTK - The desktop application code
3) Gramps Connect - The web application code

They could all still exist in the same repository, but perhaps they all have their own packaging.

Something to consider.

~Brian


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
Brian,

This is certainly worth considering.

We could have three top level python packages:  gramps,  gramps-gtk and
gramps-connect.

How would we split up the distributions?  The core distribution would
need everything required to run Gramps from the command line.  The gtk
distribution would contain the gui package.

Some of the plugins require gtk, but others don't.  Reports can be run
from the cli - gramplets require a gui - some tools have a gui dialog.  
Are images in the image directory required for report generation?

Has anyone thought about this in any detail yet?

Nick.


On 21/05/12 13:37, Brian Matherly wrote:

>> For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.
>
> Should be consider splitting the code into three different "projects"?
>
> 1) Gramps Core - The gen.lib and all general core code
> 2) Gramps GTK - The desktop application code
> 3) Gramps Connect - The web application code
>
> They could all still exist in the same repository, but perhaps they all have their own packaging.
>
> Something to consider.
>
> ~Brian
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

robhealey1
In reply to this post by Benny Malengier
Dear Benny:

I am glad to see that the excitement for this project is starting...  Without the help of so many people, it would never have happened...

I am having a problem with imports that you showed down below.  Please look down this email...

On Mon, May 21, 2012 at 5:10 AM, Benny Malengier <[hidden email]> wrote:


2012/5/20 Rob Healey <[hidden email]>
Dear Jerome:

On Sun, May 20, 2012 at 7:42 AM, Jérôme <[hidden email]> wrote:
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

I agree with part of this, but not all of it!  Benny Malengier said that he wants all of the test directories included!

Indeed. If you have a test framework, you should give the user who installed your code the option to run the tests and verify the library is working on their computer.
Obviously this is only possible if the test directories are part of the tests.

It is common to include in the README how the tests can be run from the command line. So once we install gramps in dist-packages, the line would be something like:

To test gramps is working as expected, you can run the testsuite with the command

python -c 'import gramps; gramps.test();'

I have tried this and it doesn't work for me...

Above assumes import gramps makes a test function available. For the gramps-connect code, that would then install in a gramps-connect folder, and gramps connect can use code like:

$ python
Python 2.7.3 (default, Apr 30 2012, 20:31:33)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from gramps.gen.lib import PrimaryObject
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gramps/gen/lib/__init__.py", line 27, in <module>
    from gen.lib.date import Date, DateError, Span
ImportError: No module named gen.lib.date
>>>

$ cd /usr/lib/python2.7/site-packages/gramps
[gramps]$ ls -lah gen
total 68K
drwxr-xr-x.  9 root root 4.0K May 21 14:46 .
drwxr-xr-x. 16 root root 4.0K May 21 14:46 ..
drwxr-xr-x.  2 root root 4.0K May 21 14:46 db
drwxr-xr-x.  2 root root 4.0K May 21 14:46 display
-rw-rw-r--.  1 root root 3.0K May 21 14:46 ggettext.py
-rw-r--r--.  1 root root 2.4K May 21 14:47 ggettext.pyc
-rw-rw-r--.  1 root root 1.1K May 21 14:46 __init__.py
-rw-r--r--.  1 root root  367 May 21 14:47 __init__.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 lib
drwxr-xr-x.  2 root root 4.0K May 21 14:46 mime
drwxr-xr-x.  6 root root 4.0K May 21 14:46 plug
drwxr-xr-x.  2 root root 4.0K May 21 14:46 proxy
-rw-rw-r--.  1 root root 3.0K May 21 14:46 updatecallback.py
-rw-r--r--.  1 root root 2.5K May 21 14:47 updatecallback.pyc
-rw-rw-r--.  1 root root 3.1K May 21 14:46 user.py
-rw-r--r--.  1 root root 3.1K May 21 14:47 user.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 utils

[ gramps]$ cd gen/lib
[ lib]$ ls -lah date*

-rw-rw-r--. 1 root root 2.9K May 21 14:46 datebase.py
-rw-r--r--. 1 root root 2.5K May 21 14:47 datebase.pyc
-rw-rw-r--. 1 root root  69K May 21 14:46 date.py
-rw-r--r--. 1 root root  52K May 21 14:47 date.pyc

This directory struture is here simply to show you that the files are there...

Sincerely yours,
Rob G. Healey



For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.

Benny




--
Sincerely yours,
Rob G. Healey



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Brian Matherly
In reply to this post by Nick Hall-6
>Brian,

>
>This is certainly worth considering.
>
>We could have three top level python packages:  gramps,  gramps-gtk and
>gramps-connect.
>
>How would we split up the distributions?  The core distribution would
>need everything required to run Gramps from the command line.  The gtk
>distribution would contain the gui package.
>
>Some of the plugins require gtk, but others don't.  Reports can be run
>from the cli - gramplets require a gui - some tools have a gui dialog. 
>Are images in the image directory required for report generation?
>
>Has anyone thought about this in any detail yet?


You are probably the first :)

You're on the right track, for sure. I can imagine that there would be a category of reports that only apply to the GTK distribution (gramplets and tools, maybe).

We have been slowly chipping away and improving the file organization:
http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization

We might have to make some tweaks to that plan if we want to go to different distributions.

~BM


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Benny Malengier
In reply to this post by robhealey1
Ok, can a python guru tune in here? This is an important style decision to make, and I don't know myself what is the custom.

The question is how to do imports in a package if the package is installed in site-packages or dist-packages ...

We now do in a file:
File "/usr/lib/python2.7/site-
packages/gramps/gen/lib/__init__.py", line 27, in <module>

from gen.lib.date import Date, DateError, Span

but then we obtain an error:
ImportError: No module named gen.lib.date
 
this is because we are in  a python console:

$ python
Python 2.7.3 (default, Apr 30 2012, 20:31:33)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from gramps.gen.lib import PrimaryObject

So, how to fix it?

1. Use relative imports within a module

I think this is common. As we are in gen/lib/ dir, we should code it like:
from .date import Date, DateError, Span

see
http://docs.python.org/whatsnew/2.5.html#pep-328

I think we should do this as much as possible, but we want to split up gramps in pieces, so when importing outside of the piece core/gtk/connect, we need absolute import

2. Always absolute import. So we need to change the code everywhere to

from gramps.gen.lib.date import Date, DateError, Span

This is different from current Gramps, but is the correct behavior. Somewhere at the start of gramps.py, we place the src directory of Gramps in PYTHONPATH, which implies that import like 'from gen.lib ...' work.  This is not very correct behaviour.

The big problem here, is that since python 2.7, doing from gramps.gen will import the installed site-package version, _NOT_ the version you want to execute in trunk!

With my own code, I did not find out how I can use PYTHONPATH, to make execution use your local version. Does anybody know. Should

PYTHONPATH=/home/me/gramps-trunk/ python -c from gramps.gen.lib import PrimaryObject'

work to install PrimaryObject from /home/me/gramps-trunk/ instead of from site-packages?

3. I would need to experiment somewhat, but my suggestion would be:
a/ use relative imports within subpackage, so inside of gramps/gen, gramps/gtk, ..., but not in gramps/plugins
b/ use absolute imports between subpackages and in gramps/plugins, do some tests to understand how gramps must be run so as to import a development version correctly instead of the globally installed version

Anybody can add to this?

Benny
2012/5/22 Rob Healey <[hidden email]>
Dear Benny:

I am glad to see that the excitement for this project is starting...  Without the help of so many people, it would never have happened...

I am having a problem with imports that you showed down below.  Please look down this email...

On Mon, May 21, 2012 at 5:10 AM, Benny Malengier <[hidden email]> wrote:


2012/5/20 Rob Healey <[hidden email]>
Dear Jerome:

On Sun, May 20, 2012 at 7:42 AM, Jérôme <[hidden email]> wrote:
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

I agree with part of this, but not all of it!  Benny Malengier said that he wants all of the test directories included!

Indeed. If you have a test framework, you should give the user who installed your code the option to run the tests and verify the library is working on their computer.
Obviously this is only possible if the test directories are part of the tests.

It is common to include in the README how the tests can be run from the command line. So once we install gramps in dist-packages, the line would be something like:

To test gramps is working as expected, you can run the testsuite with the command

python -c 'import gramps; gramps.test();'

I have tried this and it doesn't work for me...


Above assumes import gramps makes a test function available. For the gramps-connect code, that would then install in a gramps-connect folder, and gramps connect can use code like:

$ python
Python 2.7.3 (default, Apr 30 2012, 20:31:33)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from gramps.gen.lib import PrimaryObject

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gramps/gen/lib/__init__.py", line 27, in <module>
    from gen.lib.date import Date, DateError, Span
ImportError: No module named gen.lib.date
>>>

$ cd /usr/lib/python2.7/site-packages/gramps
[gramps]$ ls -lah gen
total 68K
drwxr-xr-x.  9 root root 4.0K May 21 14:46 .
drwxr-xr-x. 16 root root 4.0K May 21 14:46 ..
drwxr-xr-x.  2 root root 4.0K May 21 14:46 db
drwxr-xr-x.  2 root root 4.0K May 21 14:46 display
-rw-rw-r--.  1 root root 3.0K May 21 14:46 ggettext.py
-rw-r--r--.  1 root root 2.4K May 21 14:47 ggettext.pyc
-rw-rw-r--.  1 root root 1.1K May 21 14:46 __init__.py
-rw-r--r--.  1 root root  367 May 21 14:47 __init__.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 lib
drwxr-xr-x.  2 root root 4.0K May 21 14:46 mime
drwxr-xr-x.  6 root root 4.0K May 21 14:46 plug
drwxr-xr-x.  2 root root 4.0K May 21 14:46 proxy
-rw-rw-r--.  1 root root 3.0K May 21 14:46 updatecallback.py
-rw-r--r--.  1 root root 2.5K May 21 14:47 updatecallback.pyc
-rw-rw-r--.  1 root root 3.1K May 21 14:46 user.py
-rw-r--r--.  1 root root 3.1K May 21 14:47 user.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 utils

[ gramps]$ cd gen/lib
[ lib]$ ls -lah date*

-rw-rw-r--. 1 root root 2.9K May 21 14:46 datebase.py
-rw-r--r--. 1 root root 2.5K May 21 14:47 datebase.pyc
-rw-rw-r--. 1 root root  69K May 21 14:46 date.py
-rw-r--r--. 1 root root  52K May 21 14:47 date.pyc

This directory struture is here simply to show you that the files are there...


Sincerely yours,
Rob G. Healey



For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.

Benny




--
Sincerely yours,
Rob G. Healey




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
I'm not a python guru, so we could still benefit from expert input here.

If we split Gramps into separate packages, then the core package will need to be accessed by absolute imports.  This means that we will need to create a real 'gramps' package in the repository directory structure.  The packages for the gui and gramps-connect would be top level packages not sub-packages of 'gramps'.

The directory names will be the names of the packages.  I suggest 'gramps-gui' and 'gramps-connect' rather than 'gui' and 'wepapp'.

We should still be able to use relative imports within a package.

The top level packages could either reside in the repository root directory or in a 'src' directory.

I don't see a problem with the development version.  The search path for modules is defined by the sys.path list of directories.  The current directory is searched first.  Any search path specified in PYTHONPATH will be inserted before the dist-packages path.

There may be issues with distutils because it is primarily designed to produce a single distribution package.  We should be able to get something working though.

Nick.


On 22/05/12 08:40, Benny Malengier wrote:
Ok, can a python guru tune in here? This is an important style decision to make, and I don't know myself what is the custom.

The question is how to do imports in a package if the package is installed in site-packages or dist-packages ...

We now do in a file:
File "/usr/lib/python2.7/site-
packages/gramps/gen/lib/__init__.py", line 27, in <module>

from gen.lib.date import Date, DateError, Span

but then we obtain an error:
ImportError: No module named gen.lib.date
 
this is because we are in  a python console:

$ python
Python 2.7.3 (default, Apr 30 2012, 20:31:33)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from gramps.gen.lib import PrimaryObject

So, how to fix it?

1. Use relative imports within a module

I think this is common. As we are in gen/lib/ dir, we should code it like:
from .date import Date, DateError, Span

see
http://docs.python.org/whatsnew/2.5.html#pep-328

I think we should do this as much as possible, but we want to split up gramps in pieces, so when importing outside of the piece core/gtk/connect, we need absolute import

2. Always absolute import. So we need to change the code everywhere to

from gramps.gen.lib.date import Date, DateError, Span

This is different from current Gramps, but is the correct behavior. Somewhere at the start of gramps.py, we place the src directory of Gramps in PYTHONPATH, which implies that import like 'from gen.lib ...' work.  This is not very correct behaviour.

The big problem here, is that since python 2.7, doing from gramps.gen will import the installed site-package version, _NOT_ the version you want to execute in trunk!

With my own code, I did not find out how I can use PYTHONPATH, to make execution use your local version. Does anybody know. Should

PYTHONPATH=/home/me/gramps-trunk/ python -c from gramps.gen.lib import PrimaryObject'

work to install PrimaryObject from /home/me/gramps-trunk/ instead of from site-packages?

3. I would need to experiment somewhat, but my suggestion would be:
a/ use relative imports within subpackage, so inside of gramps/gen, gramps/gtk, ..., but not in gramps/plugins
b/ use absolute imports between subpackages and in gramps/plugins, do some tests to understand how gramps must be run so as to import a development version correctly instead of the globally installed version

Anybody can add to this?

Benny
2012/5/22 Rob Healey <[hidden email]>
Dear Benny:

I am glad to see that the excitement for this project is starting...  Without the help of so many people, it would never have happened...

I am having a problem with imports that you showed down below.  Please look down this email...

On Mon, May 21, 2012 at 5:10 AM, Benny Malengier <[hidden email]> wrote:


2012/5/20 Rob Healey <[hidden email]>
Dear Jerome:

On Sun, May 20, 2012 at 7:42 AM, Jérôme <[hidden email]> wrote:
Nick,

It sounds good! :)

Note, maybe a minor cosmetic improvement on 'sdist' command:
to also remove 'test' directories?
ie. to add lines on MANIFEST.in, something like:

I agree with part of this, but not all of it!  Benny Malengier said that he wants all of the test directories included!

Indeed. If you have a test framework, you should give the user who installed your code the option to run the tests and verify the library is working on their computer.
Obviously this is only possible if the test directories are part of the tests.

It is common to include in the README how the tests can be run from the command line. So once we install gramps in dist-packages, the line would be something like:

To test gramps is working as expected, you can run the testsuite with the command

python -c 'import gramps; gramps.test();'

I have tried this and it doesn't work for me...


Above assumes import gramps makes a test function available. For the gramps-connect code, that would then install in a gramps-connect folder, and gramps connect can use code like:

$ python
Python 2.7.3 (default, Apr 30 2012, 20:31:33)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from gramps.gen.lib import PrimaryObject

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gramps/gen/lib/__init__.py", line 27, in <module>
    from gen.lib.date import Date, DateError, Span
ImportError: No module named gen.lib.date
>>>

$ cd /usr/lib/python2.7/site-packages/gramps
[gramps]$ ls -lah gen
total 68K
drwxr-xr-x.  9 root root 4.0K May 21 14:46 .
drwxr-xr-x. 16 root root 4.0K May 21 14:46 ..
drwxr-xr-x.  2 root root 4.0K May 21 14:46 db
drwxr-xr-x.  2 root root 4.0K May 21 14:46 display
-rw-rw-r--.  1 root root 3.0K May 21 14:46 ggettext.py
-rw-r--r--.  1 root root 2.4K May 21 14:47 ggettext.pyc
-rw-rw-r--.  1 root root 1.1K May 21 14:46 __init__.py
-rw-r--r--.  1 root root  367 May 21 14:47 __init__.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 lib
drwxr-xr-x.  2 root root 4.0K May 21 14:46 mime
drwxr-xr-x.  6 root root 4.0K May 21 14:46 plug
drwxr-xr-x.  2 root root 4.0K May 21 14:46 proxy
-rw-rw-r--.  1 root root 3.0K May 21 14:46 updatecallback.py
-rw-r--r--.  1 root root 2.5K May 21 14:47 updatecallback.pyc
-rw-rw-r--.  1 root root 3.1K May 21 14:46 user.py
-rw-r--r--.  1 root root 3.1K May 21 14:47 user.pyc
drwxr-xr-x.  2 root root 4.0K May 21 14:46 utils

[ gramps]$ cd gen/lib
[ lib]$ ls -lah date*

-rw-rw-r--. 1 root root 2.9K May 21 14:46 datebase.py
-rw-r--r--. 1 root root 2.5K May 21 14:47 datebase.pyc
-rw-rw-r--. 1 root root  69K May 21 14:46 date.py
-rw-r--r--. 1 root root  52K May 21 14:47 date.pyc

This directory struture is here simply to show you that the files are there...


Sincerely yours,
Rob G. Healey



For efficiency of gramps-connect, we might create a gramps source package that does not install the gui stuff and can be used for server environments.

Benny




--
Sincerely yours,
Rob G. Healey





------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
In reply to this post by Brian Matherly
On 22/05/12 03:24, Brian Matherly wrote:

>> Brian,
>> This is certainly worth considering.
>>
>> We could have three top level python packages:  gramps,  gramps-gtk and
>> gramps-connect.
>>
>> How would we split up the distributions?  The core distribution would
>> need everything required to run Gramps from the command line.  The gtk
>> distribution would contain the gui package.
>>
>> Some of the plugins require gtk, but others don't.  Reports can be run
> >from the cli - gramplets require a gui - some tools have a gui dialog.
>> Are images in the image directory required for report generation?
>>
>> Has anyone thought about this in any detail yet?
>
> You are probably the first :)
>
> You're on the right track, for sure. I can imagine that there would be a category of reports that only apply to the GTK distribution (gramplets and tools, maybe).
>
> We have been slowly chipping away and improving the file organization:
> http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization
>
> We might have to make some tweaks to that plan if we want to go to different distributions.

Would you like me to help with the file organisation?  If so, do you
have any suggestions where to start?  Should I just pick a directory
like 'Filters'?

Nick.


>
> ~BM
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Brian Matherly
Nick,


>>  We have been slowly chipping away and improving the file organization:
>>
> http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization
>>
>>  We might have to make some tweaks to that plan if we want to go to
> different distributions.
>
> Would you like me to help with the file organisation?  If so, do you
> have any suggestions where to start?  Should I just pick a directory
> like 'Filters'?

That would be really great. Filters would be a great place to start.

We could like the filters to be in the gen directory as shown here:
http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization#src.2Fgen.2Ffilters.2F

But they are still in the root directory:
https://gramps.svn.sourceforge.net/svnroot/gramps/trunk/src/Filters/

You can't just copy the files over because some have GUI elements like this:
https://gramps.svn.sourceforge.net/svnroot/gramps/trunk/src/Filters/_SearchBar.py

So, someone needs to sort through the functionality and separate it as appropriate.

If you are willing to put in the work, I would be happy to follow along and review things.

~Brian


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python distribution utilities (distutils) in trunk

Nick Hall-6
On 23/05/12 02:43, Brian Matherly wrote:

> Nick,
>
>
>>>   We have been slowly chipping away and improving the file organization:
>>>
>> http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization
>>>   We might have to make some tweaks to that plan if we want to go to
>> different distributions.
>>
>> Would you like me to help with the file organisation?  If so, do you
>> have any suggestions where to start?  Should I just pick a directory
>> like 'Filters'?
> That would be really great. Filters would be a great place to start.
>
> We could like the filters to be in the gen directory as shown here:
> http://www.gramps-project.org/wiki/index.php?title=GEPS_008:_File_Organization#src.2Fgen.2Ffilters.2F
>
> But they are still in the root directory:
> https://gramps.svn.sourceforge.net/svnroot/gramps/trunk/src/Filters/
>
> You can't just copy the files over because some have GUI elements like this:
> https://gramps.svn.sourceforge.net/svnroot/gramps/trunk/src/Filters/_SearchBar.py
>
> So, someone needs to sort through the functionality and separate it as appropriate.
>
> If you are willing to put in the work, I would be happy to follow along and review things.

I have made a good start and should be able to commit something tomorrow.

As the non-gui code will reside in src/gen/filters, I assume the gui
code should be moved into src/gui/filters.

I will also move src/gui/filtereditor.py and src/gui/makefilter.py into
src/gui/filters.

I have converted all the package names to lower case.  Should I do the
same with filenames?  The filenames in src/gen seem to be lower case,
but the filenames of the plugins are mixed case.

Nick.

>
> ~Brian
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
12