Hey folks.

I'm using pyglet.resource for the first time. Forgive my idiocy. Project layout:

./
  |-tanks\
  |   |-source code goes here
  |-data\
  |   |-image files go here
  |-setup.py
  |-run_game.py

in my source, I have:

    pyglet.resource.path = ['data']
    pyglet.resource.reindex()
    image = pyglet.resource.texture(name + '.png')

and this works fine.

My problem is that the 'run_game.py' I have shown above doesn't actually exist. I have no executable script. Instead I use setup.py's "entry_points" to specify that the entry point to my application is my "main" function, which resides within the source code directory.

Calling "python setup.py install" or "python setup.py develop" generates an executable script on the PATH which calls my main function. (this is standard setuptools functionality, not my own crazy invention)

When I do this, pyglet.resource is unable to find my image files, because it now thinks my top-level executable script is in my virtualenv's 'bin' directory.

I could work around this by specifying an absolute pyglet.resource.path, derived from __file__. But this will break when I package my application up and distribute the data files using setup.py's "data_files". The install location of my data doesn't have a well-defined location relative to __file__ - I have to use "pkg_resources" to find it. Based on a quick grep, I don't *think* pyglet.resource is doing that. ( But the docs say "The resource module also behaves as expected when applications are bundled using py2exe or py2app.", so I'm probably wrong.)

I guess the alternative is I could move my data files into my source code (yuck), so that I can distribute them using setup.py's 'package_data', and use pyglet.resource.path = ["@data"]?

Or I could stop using setup.py's "entry_points" and create an actual top-level "run_game.py" script. But I thought "entry_points" was "the right way to do it" for distributing python application packages?

I'm sure I can muddle through, but thought I'd air my confusion on the offchance someone could point out how I've managed to misunderstand more-or-less everything.

Feel free to lampoon me for comedy effect if it makes responding more fun.

Cheers!

    Jonathan

--
Jonathan Hartley    [email protected]    http://tartley.com
Made of meat.       +44 7737 062 225       twitter/skype: tartley

--
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to