deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.78k stars 105 forks source link

Hidden directory breaks compare #5

Closed mdiamond closed 7 years ago

mdiamond commented 7 years ago

It seems as though dotdrop compare crashes if you try to use dotdrop to manage a hidden directory.

     _       _      _
  __| | ___ | |_ __| |_ __ ___  _ __
 / _` |/ _ \| __/ _` | '__/ _ \| '_ |
 \__,_|\___/ \__\__,_|_|  \___/| .__/  v0.2
                               |_|

diffing "f_zshrc" VS "~/.zshrc"
same file
diffing "f_xresources" VS "~/.Xresources"
same file
diffing "f_xmodmap" VS "~/.Xmodmap"
same file
diffing "f_xinitrc" VS "~/.xinitrc"
same file
diffing "f_xbindkeysrc" VS "~/.xbindkeysrc"
same file
diffing "f_vimrc" VS "~/.vimrc"
same file
diffing "f_i3blocks.conf" VS "~/.i3blocks.conf"
70c70
< instance=/mSATA
---
> instance=/media/mSATA
diffing "f_conkyrc" VS "~/.conkyrc"
same file
diffing "f_compton.conf" VS "~/.config/compton.conf"
same file
diffing "d_i3" VS "~/.i3"
Traceback (most recent call last):
  File "/home/matthew/dotfiles/dotdrop/dotdrop/dotdrop.py", line 182, in <module>
    if compare(opts, conf, tmp):
  File "/home/matthew/dotfiles/dotdrop/dotdrop/dotdrop.py", line 91, in compare
    inst.compare(t, tmp, opts['profile'], dotfile.src, dotfile.dst)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/installer.py", line 168, in compare
    tmpfolder)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/installer.py", line 151, in _install_to_temp
    return self.install(templater, profile, src, tmpdst), tmpdst
  File "/home/matthew/dotfiles/dotdrop/dotdrop/installer.py", line 32, in install
    return self._handle_dir(templater, profile, src, dst)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/installer.py", line 91, in _handle_dir
    templater, profile, f, os.path.join(dst, entry))
  File "/home/matthew/dotfiles/dotdrop/dotdrop/installer.py", line 66, in _handle_file
    content = templater.generate(src, profile)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/templategen.py", line 35, in generate
    return self._handle_file(src, profile)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/templategen.py", line 42, in _handle_file
    return self._handle_bin_file(src, profile)
  File "/home/matthew/dotfiles/dotdrop/dotdrop/templategen.py", line 62, in _handle_bin_file
    with open(src, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/matthew/dotfiles/dotfiles/i3/.i3'
mdiamond commented 7 years ago

Turns out the problem was that I had a symlink to something that no longer existed in ~/dotfiles/dotfiles/i3/, and that was causing the program to break when attempting to open it.

deadc0de6 commented 7 years ago

Thanks for reporting this. I have added some checks such that an error is printed instead of a crash.

deadc0de6 commented 6 years ago

I'm adding some repositories as examples in the readme, would you be ok if I add yours as a reference ?

mdiamond commented 6 years ago

It has been awhile since I managed my dotfiles with dotdrop. Since I last attempted to use it, I built a new computer that requires a unique dotfiles configuration. Give me a bit to create a good dotdrop example that works well between my two systems and I'd be happy for you to use it as an example.

On Wed, Oct 18, 2017 at 03:14 deadc0de notifications@github.com wrote:

I'm adding some repositories as examples in the readme, would you be ok if I add yours as a reference ?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/deadc0de6/dotdrop/issues/5#issuecomment-337497376, or mute the thread https://github.com/notifications/unsubscribe-auth/ADtylodaTu6BoRPF78Q9waD26Bu687Diks5stbNQgaJpZM4Ng8lm .

deadc0de6 commented 6 years ago

sure, no problem. Let me know when you're good and I'll add yours.

thanks

mdiamond commented 6 years ago

I'm realizing that your code doesn't work on macs. I was hoping to set it up with my mac, my home pc w/ linux, and my linux laptop.

On Wed, Oct 18, 2017 at 11:48 AM, deadc0de notifications@github.com wrote:

sure, no problem. Let me know when you're good and I'll add yours.

thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/deadc0de6/dotdrop/issues/5#issuecomment-337654535, or mute the thread https://github.com/notifications/unsubscribe-auth/ADtyljKXwrlkHbANfNCxTaqo6sa9ZepWks5stivWgaJpZM4Ng8lm .

deadc0de6 commented 6 years ago

could you be more specific, what is not working ? the hidden directory compare ?

mdiamond commented 6 years ago

I don't think the hidden directory compare is a problem anymore. But there are a number of things broken. First it crashed because python3 is not in the path by default, you have to specifically install it using homebrew, the unofficial mac os package manager. Then, I had issues with docopt not being installed, which resulted in me having to easy_install pip, then pip install docopt. And finally, now, even after doing pip install docopt, dotdrop.sh crashed saying "No module named 'docopt'". I don't know what else might be wrong because I've given up lol.

Do you hope to get dotdrop working on mac? I would be open to helping when I have free time.

Matthew

On Sat, Nov 11, 2017 at 5:35 AM, deadc0de notifications@github.com wrote:

could you be more specific, what is not working ? the hidden directory compare ?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/deadc0de6/dotdrop/issues/5#issuecomment-343658635, or mute the thread https://github.com/notifications/unsubscribe-auth/ADtylljZOdoq_Yl42_4F63HCLaDzSom8ks5s1YaUgaJpZM4Ng8lm .

deadc0de6 commented 6 years ago

Of course you need to have python3 to run dotdrop. Regarding the docopt dependency (as well as other dependencies), you can easily install it with pip: sudo pip3 install -r dotdrop/requirements.txt.

Are you sure you installed the python3 version of docopt ? Since it seems mac has python2 per default so invoking pip with pip might call the python2 version. At least on some linux distribution (ubuntu/debian), you need to explicitly call pip3 in order to install python3 versions of libraries. To test that you could simply run a python shell (usually by simply running python3 at the command line) and then issuing import docopt.

I don't use mac so it's difficult to test but let me know how the above works out.