gwerbin / dotbot-autobot

🤖 Automatically update your Dotbot config file when you add files in Git.

Home Page:http://github.com/anishathalye/dotbot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Python packages requirements

nagromc opened this issue · comments

I've been trying to add your hook to my dotfiles, but I came across some missing Python packages. First, PyYAML, then pygit2.

Wouldn't be a good idea to add the needed Python packages in README.md? Even better: a single-liner to install them for each system (e.g. for Debian: sudo apt-get install python3-yaml python3-pygit2 ...)

Note: on Debian, I stumbled upon an issue where pygit2 is not included in the stable version. So, I guess it would be difficult to make it a single-liner.

Well, OK. Here is what I've tried to install pygit2 on Debian Jessie (the current stable):

  • sudo apt-get install libffi-dev libgit2-dev
  • pip install pygit2

pip logs:

[...] some logs before

running build_ext

generating cffi module 'build/temp.linux-x86_64-2.7/pygit2._libgit2.c'

creating build/temp.linux-x86_64-2.7

building '_pygit2' extension

creating build/temp.linux-x86_64-2.7/src

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fst
ack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/include -I/usr/include/python2.7 -c src/blob.c -o build
/temp.linux-x86_64-2.7/src/blob.o

In file included from src/blob.h:34:0,

                 from src/blob.c:30:

src/types.h:36:2: error: #error You need a compatible libgit2 version (v0.24.x)

 #error You need a compatible libgit2 version (v0.24.x)

  ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Unfortunately, libgit2 on Debian Jessie is only in version 0.21.1 whereas pygit2 requires libgit2 v0.24.x. So I cannot install pygit2.

Thanks for letting me know. There is a requirements.txt file that you can use like pip install -r requirements.txt, but I might have forgotten to mention it in the README.

As for the dependency version issue on Debian, that isn't something I was aware of. It should be straightforward to replace the dependency on Pygit2 with a subprocess that manually sends Git commands to a shell. I don't know that I'll have time to work on it, but feel free to make a PR.

Edit: WOW v0.21 is ancient, from January 2015. Is there any way to get that updated?

Oh, I didn't even know that requirement.txt was for pip. I'm not a Python guy ;-) And I just found out that there is a develop branch where you mentioned the installation command for the dependencies.

Well, one way to update libgit2 would be to install it from the sources, but I find this method quite dirty (and I must admit I don't have enough experience to know the potential impacts on the system).
I think this issue won't be that easy to solve without complexity...

Isn't it possible to force pip to use a previous version of pygit2 (that would use a previous version of libgit2)? Like npm, Bower, RubyGems, or Cargo?

@nagromc I didn't merge that branch because I think there was something broken with it (and I was getting tired!).

And yes, you can specify a package version with package_name==version_number in the requirements file. I'll look into the versioning at some point this week unless you're feeling enterprising and get to it first.