MestreLion / humblebundle

API for managing Humble Bundle games library
GNU General Public License v3.0
211 stars 38 forks source link

setup.py installs to /usr/bin, but cannot reference source files #20

Closed mdeguzis closed 8 years ago

mdeguzis commented 8 years ago

Running '/usr/bin/humblebundle' after install using setup.py

desktop@debian-testing:~/libregeek-packaging/humblebundle$ humblebundle 
Traceback (most recent call last):
  File "/usr/bin/humblebundle", line 9, in <module>
    load_entry_point('humblebundle==0.0.0', 'console_scripts', 'humblebundle')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
ImportError: No module named humblebundle
desktop@debian-testing:~/libregeek-packaging/humblebundle$ echo $PYTHONPATH

Setting PYTHONPATH to source code

desktop@debian-testing:~/libregeek-packaging/humblebundle$ PYTHONPATH="/home/desktop/build-humblebundle-tmp/humblebundle-0.1.0/
debian/                   gamedata.json.readme.txt  httpbot.py                makeinstall               
extras.json               .gitignore                humblebundle.py           README.md                 
gamedata.json             hooks/                    installers/               setup.py                  
desktop@debian-testing:~/libregeek-packaging/humblebundle$ PYTHONPATH="/home/desktop/build-humblebundle-tmp/humblebundle-0.1.0/" humblebundle 
2016-09-09 00:09:40,352 WARNING         Credentials not found in keyring. First time usage?
2016-09-09 00:09:40,353 ERROR           Error reading cookies: [Errno 2] No such file or directory: '/home/desktop/.config/humblebundle/cookies.txt'
2016-09-09 00:09:40,763 CRITICAL        Username or password are blank. Set with --username and --password and try again

From a packaging perspective for making a Debian package, this seems off. I suppose I could make a launcher with PYTHONPATH in it.

The contents of /usr/bin/humblebundle:

#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'humblebundle==0.0.0','console_scripts','humblebundle'
__requires__ = 'humblebundle==0.0.0'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('humblebundle==0.0.0', 'console_scripts', 'humblebundle')()
    )
mdeguzis commented 8 years ago

Ok, I see. During a Debian build the .py files are byte-compiled. There only seems to be a few basic files truly needed for startup:

desktop@debian-testing:~/tmp$ ls
gamedata.json  httpbot.pyc  humblebundle.pyc
desktop@debian-testing:~/tmp$ PYTHONPATH="/home/desktop/tmp" humblebundle 
2016-09-09 00:18:40,327 WARNING         Credentials not found in keyring. First time usage?
2016-09-09 00:18:40,788 CRITICAL        Username or password are blank. Set with --username and --password and try again

Perhaps it's too early as I see there is section for using it as a library. I see Debian deb_helper write .egg files into /usr/lib, but apparently not all it needs.

mdeguzis commented 8 years ago

I'll take care of this myself for now unless anyone has any other ideas. I'm no python guru (yet). I will just use sys.path as such.

sys.path.append('/path/to/whatever')