1
0
Fork 0
mirror of synced 2024-11-16 13:35:35 -05:00
Commit graph

211 commits

Author SHA1 Message Date
tpansin
322661dde1 Added support to run with python -m 2020-07-23 08:44:06 -07:00
Anish Athalye
c5e709d433 Make error for empty config a little friendlier
In the setup guide in the README, we have people start out with an empty
file (created using `touch`). Before this patch, Dotbot gave the
following error:

    Configuration file must be a list of tasks

Instead, with this patch, Dotbot says:

    Configuration file is empty, no work to do

This change was prompted by
https://github.com/anishathalye/dotbot/pull/226.
2020-06-25 16:07:23 -04:00
Anish Athalye
043373ea74 Standardize documentation for extended config
This patch adds parameter/explanation tables for the two other commands
that support extended configuration syntaxes, so now we have
identically-formatted tables for link, shell, and clean.

This change was prompted by
https://github.com/anishathalye/dotbot/issues/223.
2020-06-19 20:31:43 -04:00
Anish Athalye
8f136ee73f Remove confusing example
Without an explanation of what's going on here, this example is
unnecessarily confusing. It's a neat example, but probably not worth
explaining this in Dotbot's README.

See https://github.com/anishathalye/dotbot/issues/224.
2020-06-19 20:02:03 -04:00
Anish Athalye
f5e019105e Work around subprocess.call() issue on Windows
On POSIX-like systems, calling `subprocess.call()` with both
`shell=True` and `executable='...'` has the following behavior:

> If `shell=True`, on POSIX the _executable_ argument specifies a
> replacement shell for the default `/bin/sh`.

(via https://docs.python.org/3/library/subprocess.html?highlight=subprocess#popen-constructor)

This seems to have a similar behavior on Windows, but this is
problematic when a POSIX shell is substituted for cmd.exe. This is
because when `shell=True`, the shell is invoked with a '/c' argument,
which is the correct argument for cmd.exe but not for Bash, which
expects a '-c' argument instead. See here:
1def7754b7/Lib/subprocess.py (L1407)

This is problematic when combined with Dotbot's behavior, where the
`executable` argument is set based on `$SHELL`. For example, when
running in Git Bash, the `$SHELL` environment variable is set to Bash,
so any commands run by Dotbot will fail (because it'll invoke Bash with
a '/c' argument).

This behavior of setting the `executable` argument based on `$SHELL` was
introduced in 7593d8c134. This is the
desired behavior. See discussion in
https://github.com/anishathalye/dotbot/issues/97 and
https://github.com/anishathalye/dotbot/pull/100.

Unfortunately, this doesn't work quite right on Windows. This patch
works around the issue by avoiding setting the `executable` argument
when the platform is Windows, which is tested using
`platform.system() == 'Windows'`. This means that shell commands
executed by Dotbot on this platform will always be run using cmd.exe.
Invocations of single programs or simple commands will probably work
just fine in cmd.exe. If Bash-like behavior is desired, the user will
have to write their command as `bash -c '...'`.

This shouldn't have any implications for backwards-compatibility,
because setting the `executable` argument on Windows didn't do the right
thing anyways. Previous workarounds that users had should continue to
work with the new code.

When using Python from CYGWIN, `platform.system()` returns something
like 'CYGWIN_NT-...', so it won't be detected with the check, but this
is the correct behavior, because CYGWIN Python's `subprocess.call()` has
the POSIX-like behavior.

This patch also refactors the code to factor out the
`subprocess.call()`, which was being called in both `link.py` and
`shell.py`, so the workaround can be applied in a single place.

See the following issues/pull requests for a discussion of this bug:
- https://github.com/anishathalye/dotbot/issues/170
- https://github.com/anishathalye/dotbot/pull/177
- https://github.com/anishathalye/dotbot/issues/219

An issue has also been raised in Python's issue tracker:
- https://bugs.python.org/issue40467

Thanks to @shivapoudel for originally reporting the issue, @SuJiKiNen
for debugging it and submitting a pull request, and @mohkale for
suggesting factoring out the code so that other plugins could use it.
2020-05-01 11:52:51 -04:00
Anish Athalye
7ffaa65482 Add --only and --except command-line arguments
Internal to Dotbot, we use the name "skip" instead of "except", because
the latter is a keyword, and using a name like "except_" didn't seem as
nice.
2020-03-26 11:23:07 -04:00
Anish Athalye
5d83f9e797 Upgrade PyYAML to 5.3 2020-01-06 20:11:22 -05:00
Anish Athalye
9281d120dd Release 1.17.0 2020-01-03 16:47:57 -05:00
Anish Athalye
ec8498ffb8 Merge branch 'ypid/add/link_real_path_option' 2020-01-03 16:46:19 -05:00
Anish Athalye
320d5d0123 Add tests for canonicalize-path 2020-01-03 16:45:35 -05:00
Robin Schneider
138fdbc8d7
Add 'canonicalize-path' option to link
Dotbot had a hardcoded behaviour that the BASEDIR was always passed to
os.path.realpath which "returns the canonical path of the specified
filename, eliminating any symbolic links encountered in the path".

This might not always be desirable so this commit makes it configurable.

The use case where `canonicalize-path` comes in handy is the following:
You want to provide dotfiles in the Filesystem Hierarchy Standard under
`/usr/local/share/ypid_dotfiles/`. Now you want to provide
`.config/dotfiles` as a default in `/etc/skel`. When you now
pre-configure `/etc/skel` by running dotbot in it set has HOME, dotfiles
will refer to `/usr/local/share/ypid_dotfiles/` and not
`/etc/skel/.config/dotfiles` which does not look nice.

This is related to but not the same as the `relative` parameter used
with link commands.
2020-01-03 22:35:13 +01:00
Anish Athalye
3fcc13d803 Update dates 2020-01-03 16:19:21 -05:00
Anish Athalye
6d24613b0b Unify Vagrant and Travis-CI tests
This patch makes the tests (including the test driver) run entirely
inside Vagrant, which avoids calling the very slow `vagrant` driver many
times for running the tests. On my machine, `./test` runs in 22 seconds,
down from hundreds of seconds prior to this patch.

This also has the nice side effect of matching how the Travis CI tests
were run, so there's no need for a separate `test_travis` anymore.
2020-01-03 15:34:46 -05:00
Anish Athalye
1e1885c45a Fix incorrect use of is over ==
Comparing strings and integers with `is` is a bug: comparisons should be
done with `==`. It might not have caused observable problems in the past
because small integers and strings can be interned.
2020-01-03 15:31:24 -05:00
Anish Athalye
a7ed166817 Add Python 3.8 to Travis tests 2020-01-03 14:00:13 -05:00
Anish Athalye
e38e021ab3 Add option to clean recursively 2019-12-31 19:14:23 -05:00
Anish Athalye
81f0d74955 Fix clean not respecting defaults
Previously, clean read the defaults once, and then it updated the
setting for each entry it read. This resulted in the defaults being
clobbered and then not being respected for subsequent entries. This
patch fixes the issue by re-reading the defaults before processing each
item.

The other plugins (link, shell) do not have this problem.
2019-12-31 14:47:32 -05:00
Anish Athalye
a7bfce3e23 Merge branch 'apuignav/ignore-missing' 2019-12-31 14:26:26 -05:00
Albert Puig
eabd84bce1 Add ignore-missing option to link 2019-12-31 14:25:53 -05:00
Anish Athalye
a8380f6496 Migrate to travis-ci.com 2019-12-28 10:44:24 -05:00
Anish Athalye
2c8a0431ed Bump PyYAML version to 5.1.2 2019-11-20 10:47:10 -05:00
Anish Athalye
8667b75a73 Add example of conditional link 2019-11-14 16:30:47 -05:00
Anish Athalye
7f97a6c6d0 Make list more compact 2019-11-12 15:01:03 -05:00
Anish Athalye
2c27655500 Merge branch 'jesseleite/readme-organization' 2019-11-12 13:44:49 -05:00
Jesse Leite
daf3a7c483 Add table of contents and organize headings a bit 2019-11-12 13:44:28 -05:00
Anish Athalye
2dc876cd65 Merge branch 'paulohefagundes/remove_which' 2019-11-09 12:40:20 -05:00
Paulo Fagundes
d2913e6cee Replace which with command -v
Some distributions such as Arch Linux no longer install `which` by
default through the base package (see
https://www.archlinux.org/news/base-group-replaced-by-mandatory-base-package-manual-intervention-required/).

The maintainers have explained why `command -v` is superior:
https://www.reddit.com/r/archlinux/comments/de1er6/arch_linux_news_base_group_replaced_by_mandatory/f2v8uhu/.
2019-11-09 12:38:01 -05:00
Anish Athalye
5bb3c8a343 Release 1.16.0 2019-10-12 12:02:40 -04:00
Anish Athalye
04c113b5b8 Merge branch 'jesseleite/create-directive' 2019-10-12 11:55:18 -04:00
Jesse Leite
5a0f6676d4 Add 'create' directive to create directories 2019-10-12 11:55:09 -04:00
Anish Athalye
32741ea0ca Switch to more recent version of Debian 2019-10-12 10:36:35 -04:00
Anish Athalye
cdef01e9c4 Merge branch 'darsh12/master' 2019-09-17 08:35:08 -04:00
Darshan Patel
d6975dc660 Add instructions to ignore dirty commits 2019-09-17 08:34:58 -04:00
Anish Athalye
d20984f5ac Remove explicit specification of environment 2019-08-18 14:25:04 -04:00
Anish Athalye
4ca0cb5445 Update Travis CI config
- Use Xenial for all tests
- Drop support for Python 3.2 and Python 3.3
2019-08-18 14:17:55 -04:00
Anish Athalye
9a8d292681 Make launcher prefer python over python3
This patch makes the launcher script prefer `python`, when present, over
`python3`. This way, the launcher uses the user's preferred `python`
(which is often set up as a symbolic link to a particular python2.x or
python3.x), when available.
2019-06-26 15:00:07 -04:00
Anish Athalye
8454021d66 Merge branch 'ronalabraham/patch-1' 2019-06-05 14:32:53 -04:00
ronalabraham
017c70b5b0
Change target to source for consistency with docs 2019-06-04 15:20:00 -04:00
ronalabraham
c97472bc27
Fix path parameter's docs for linking feature 2019-06-04 14:42:21 -04:00
Anish Athalye
b062aeaf15 Simplify README
This patch removes JSON examples from the README.
2019-02-06 09:30:49 -05:00
Anish Athalye
cd04d886fe Update dates 2019-01-09 20:46:21 -05:00
Anish Athalye
fa33cda9e6 Add Python 3.7 to Travis CI tests 2019-01-09 20:45:31 -05:00
Anish Athalye
5d74f29001 Release 1.15.0 2018-11-21 19:52:03 -05:00
Anish Athalye
5e2d40939e Merge branch 'thtliife/suppress-shell-cmd' 2018-11-21 19:50:46 -05:00
Anish Athalye
dc05786693 Add test 2018-11-21 19:50:32 -05:00
Vito Giarrusso
3bda18ed9c Add quiet option to shell plugin 2018-11-21 19:50:32 -05:00
Anish Athalye
8558a5dca0 Release 1.14.1 2018-11-19 20:39:19 -05:00
Anish Athalye
b35462ab95 Merge branch 'qubidt/default-link-conditional' 2018-11-19 20:38:59 -05:00
Anish Athalye
1be9f7532b Add test 2018-11-19 20:38:29 -05:00
Bao Trinh
7add866215
Support defining default conditional option for links 2018-11-17 15:00:18 -06:00