[issue12394] packaging: generate scripts from callable (dotted paths)

Éric Araujo report at bugs.python.org
Fri Jul 22 02:01:43 CEST 2011


Éric Araujo <merwok at netwok.org> added the comment:

Great to hear these news!  I will pull from your clone and test on linux2 as soon as possible.

In your Mercurial configuration file, you should set the git option so that diffs can display editions to binary files.  See http://hgtip.com/tips/beginner/2009-10-22-always-use-git-diffs/

> Usage: Just add a 'wrapper-scripts-entries' variable in setup.cfg,
The new scripts feature should reuse the already existing scripts field, in the files section.

> which takes a list type as its value. For instance,
> wrapper-scripts-entries = ['hello=demo.foo.bar:main']
Config files don’t have lists, but they have multi-line values.  See the packaging/setupcfg doc for more info; here’s an example:

  scripts =
      hello = demo.foo.bar.main

(we use dotted paths throughout packaging, not paths with dots and colons, BTW)

> Current patch can generte executable script with no extension on
> POSIX, and .exe file on Windows but have not yet added gui support.
Looks like a great start!  As I said in private email, have a look at the distribute fork of setuptools to see if they have tests for these features.

> In the 'test_command_build_scripts.py', how to test the generated
> .exe wrapper to see if it can run and generate correct output or not?
> The only way I can remember is to use os.system(), but if we use
> os.system() to execute the .exe file, then it will not get the what
> we want, because it will run in another thread, thus can not get the
> right sys.path which I have set in my test function.
os.system runs a process, not a thread.  You should use the subprocess module, it’s better than os.system.  To pass a custom sys.path, set up a PYTHONPATH environment variable in the env argument of subprocess.Popen.  test_sys and test_site have examples of how to use subprocess.

(Before someone suggests using the helpers in test.support, know that I prefer to use only subprocess, to ease the future backport.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12394>
_______________________________________


More information about the Python-bugs-list mailing list