rubik / pyg

A Python Package Manager
http://pyg-installer.co.nr
MIT License
21 stars 3 forks source link

Pack: Issues with packages containing "-" #104

Closed fdev31 closed 13 years ago

fdev31 commented 13 years ago

A cleanup should be done... Python mangles names from the real folder name to make an import compatible name... "-" are converted to "_" but I'm not sure about all the rules... We need such a conversion function to be able to pack packages with dependencies containing unsupported characters...

To check the bug:

pyg pack bee.zip zicbee

Then unpack bee.zip & start run_wasp.py ....

rubik commented 13 years ago

Now it cannot build! :)

$ pyg -d pack bee.zip zicbee
Generating the bundle...
zicbee:
        Retrieving data for zicbee [100% - 316.8 Kb / 316.8 Kb]              
        Writing data into zicbee-0.9-rc9.tar.gz
        zicbee downloaded successfully
        Looking for zicbee==0.9-rc9 dependencies
                Found: zicbee-lib>=0.7.3
                Found: buzhug>=1.8
                Found: mutagen>=1.20
                Found: web.py>=0.34
                Found: zicbee-mplayer>=0.9
zicbee-mplayer>=0.9:
        Retrieving data for zicbee-mplayer [67% - 8.0 Kb / 12.0 Kb] 00s remainin                                                                                        Retrieving data for zicbee-mplayer [100% - 12.0 Kb / 12.0 Kb] 
        Writing data into zicbee-mplayer-0.9.1.tar.gz
        zicbee-mplayer downloaded successfully
        Looking for zicbee-mplayer==0.9.1 dependencies
                None found
web.py>=0.34:
        Retrieving data for web.py [100% - 85.9 Kb / 85.9 Kb]              
        Writing data into web.py-0.36.tar.gz
        web.py downloaded successfully
        Looking for web.py==0.36 dependencies
                None found
mutagen>=1.20:
        Warning: did not find any files on PyPI
        Looking for packages at http://pypi.python.org/simple
        Retrieving data for mutagen [100% - 636.4 Kb / 636.4 Kb]              
        Writing data into mutagen-1.20.tar.gz
        mutagen downloaded successfully
        Looking for mutagen==1.20 dependencies
                None found
buzhug>=1.8:
        Warning: did not find any files on PyPI
        Looking for packages at http://pypi.python.org/simple
        .tar.gz files not found. Continue searching...
        .tar.bz2 files not found. Continue searching...
        Retrieving data for buzhug [100% - 25.9 Kb / 25.9 Kb]              
        Writing data into buzhug-1.8.zip
        buzhug downloaded successfully
        Looking for buzhug==1.8 dependencies
                None found
zicbee-lib>=0.7.3:
        Retrieving data for zicbee-lib [100% - 22.1 Kb / 22.1 Kb]              
        Writing data into zicbee-lib-0.7.3.tar.gz
        zicbee-lib downloaded successfully
        Looking for zicbee-lib==0.7.3 dependencies
                None found
Finished processing dependencies
debug: bundle: cleaning build dir
debug: Removing: buzhug-1.8.zip
debug: Removing: web.py-0.36.tar.gz
debug: Removing: zicbee-0.9-rc9.tar.gz
debug: Removing: zicbee-mplayer-0.9.1.tar.gz
debug: Removing: zicbee-lib-0.7.3.tar.gz
debug: Removing: mutagen-1.20.tar.gz
Traceback (most recent call last):
  File "/usr/local/bin/pyg", line 8, in <module>
    load_entry_point('pyg==0.8a', 'console_scripts', 'pyg')()
  File "/home/miki/pyg/pyg/__init__.py", line 28, in main
    parser.dispatch(argv=argv)
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 304, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 205, in dispatch
    for line in lines:
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 281, in _execute_command
    for line in result:
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 264, in _call
    result = args.function(args)
  File "/home/miki/pyg/pyg/parser/parser.py", line 285, in pack
    return opts.pack_func(args.package, args.packname, exclude, use_develop)
  File "/home/miki/pyg/pyg/parser/_opts.py", line 266, in pack_func
    Packer(Requirement(package), packname, dest).gen_pack(exclude, use_develop)
  File "/home/miki/pyg/pyg/pack.py", line 287, in gen_pack
    self._gen_eggs(tempdir, egg_dir)
  File "/home/miki/pyg/pyg/pack.py", line 265, in _gen_eggs
    arch = glob.glob(os.path.join(tempdir, dist) + '*.egg')[0]
IndexError: list index out of range
rubik commented 13 years ago

Ok, fixed! :) It glob'd for zicbee-0.9-rc9*.egg and the directory contained zicbee-0.9_rc9-py2.7.egg. I fixed it by deleting every egg after its generation...

Now I can reproduce the bug:

miki@miki-laptop:~/zicbee-0.9-rc9$ python run_wasp.py 
Traceback (most recent call last):
  File "run_wasp.py", line 27, in <module>
    import zicbee_lib.wasp
ImportError: No module named zicbee_lib.wasp
rubik commented 13 years ago

Oops clicked on the wrong button while commenting... :)

rubik commented 13 years ago

Now my system cannot open the egg...

fdev31 commented 13 years ago

This is because it's looking for something called "zicbee-mplayer" (via the glob call) but the only folder is "zicbee_mplayer" (it's the module name at import time), I'll try something about that and tell you if that's fixing the problem...

rubik commented 13 years ago

With the new generation method (without single EGG-INFO) and your function name_from_name this issue is closed, I think.