Search code examples
pythonpython-2.7pygamepython-wheel

Python wheeling local module


I am writing a project that requires pygame.

I've installed pygame in python following the instructions from the pygame wiki.

pip install hg+http://bitbucket.org/pygame/pygame

I would like to add pygame to the wheel directory that I am creating. I am attempting to do this with the command

pip wheel --wheel-dir=wheels/linux64 pygame

I have tried adding in the --no-index, --find-links=https://bitbucket.org/pygame/pygame, --allow-unverified pygame, --allow-external pygame options.

The output is always something along the lines of not finding a package that satifies the requirement pygame.

Downloading/unpacking pygame
  Could not find any downloads that satisfy the requirement pygame
  Some externally hosted files were ignored (use --allow-external pygame to allow).
Cleaning up...
No distributions at all found for pygame
Storing debug log for failure in /home/eric/.pip/pip.log

How can I wheel my local version of pygame and add it to my wheel directory?


Solution

  • You need to point pip to the source dir in order to make a wheel. For example:

    $ hg clone https://bitbucket.org/pygame/pygame
    ...
    ...
    $ pip wheel pygame/
    Processing ./pygame
    Building wheels for collected packages: pygame
      Running setup.py bdist_wheel for pygame
      Stored in directory: /home/vagrant/wheelhouse
    Successfully built pygame
    (test)vagrant@vagrant-ubuntu-trusty-64:~$ ll /home/vagrant/wheelhouse
    total 3264
    drwxrwxr-x 2 vagrant vagrant    4096 Sep  6 01:24 ./
    drwxr-xr-x 7 vagrant vagrant    4096 Sep  6 01:24 ../
    -rw-rw-r-- 1 vagrant vagrant 3333795 Sep  6 01:24 pygame-1.9.2a0-cp27-none-linux_x86_64.whl
    

    You cannot create wheel from installed module since it's missing the install instructions part (setup.py). For more info check wheel's usage instructions.