Sheeprider / BitBucket-api

Python library to interact with BitBucket REST API
ISC License
76 stars 65 forks source link

Windows support for bitbucket-api? #24

Open davehorner opened 8 years ago

davehorner commented 8 years ago

I am using Python 2.7.11 with pip 8.1.2;

When I try to install the bitbucket-api I get the following: pip install bitbucket-api Collecting bitbucket-api Using cached bitbucket-api-0.5.0.tar.gz Requirement already satisfied (use --upgrade to upgrade): requests in c:\python27\lib\site-packages (from bitbucket-api) Collecting sh (from bitbucket-api) Using cached sh-1.11.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "c:\users\xxx\appdata\local\temp\pip-build-nrkwol\sh\setup.py", line 4, in import sh File "sh.py", line 37, in support." % version) ImportError: sh 1.11 is currently only supported on linux and osx. please install pbs 0.110 (http://pypi.python.org/pypi/pbs) for windows support.

I have no issues installng pbs. pip install pbs Collecting pbs Downloading pbs-0.110.tar.gz Installing collected packages: pbs Running setup.py install for pbs ... done Successfully installed pbs-0.110

However, this does not resolve the issue above with sh 1.11 indicating I should install pbs.

Any ideas on how to resolve this issue for those of us running on windows? Thanks. --dave

dragon788 commented 8 years ago

The issue is that the package's setup.py explicitly includes the requirement for sh. You can clone this git repo, edit the setup.py to remove the requirement for sh and then install from the locally cloned version using pip install path/to/clone and then utilize the library however you wish.

Another option is pip install --no-deps bitbucket-api ; pip install requests requests_oauthlib This will get all the pieces that are required without sh failing the install of bitbucket-api on Windows.

As the warning says you could potentially use pbs in place of sh, but so far I haven't found the code where this requirement is actually utilized. I ran all the tests in the public folder after doing the above without any errors. I'm going to be building a utility that uses this library though, so I'll update this as I come across any failure instances and see if it's possible to "downgrade" the requirement to pbr if it isn't using some fancy functions only available in sh.

guyzmo commented 8 years ago

I'm having a dependency on Bitbucket-api, and just had someone complaining about the impossibility for him to install my tool on windows, because of the sh dependency.

As I said on guyzmo/git-repo#37, this issue shouldn't happen, as sh is only used for tests on the repository.

The solution lies in a few lines of code, simply removing the dependency for installation in both setup.py and requirements.txt.