Attempted to address various cross-platform installation issues:
- Removed all hard-coded references to file-paths, and replaced them
with paths provided by `appdirs`.
- Removed (erroneously inserted) default file paths which would never be
checked due to application logic.
- Modified `setup.py` to no longer install a configuration file. The
mechanics are still in place to **read** a configuration file, but
after examination, I've concluded that the installation of that file
is best left to package maintainers rather than `cheat` itself.
The prior attempt to resolve#420 and #431 relied on `appdirs` to
determine the appropriate directories into which to install files.
Previously, `setup.py` dynamically attempted to install `appdirs` via
`pip` during installation if necessary.
This attempt to failed on multiple platforms, however, due to
backwards-incompatible `pip` interfaces.
As a workaround, I have now directly included `appdirs` (a small module)
within `cheat` itself. This approach is explicitly supported per the
`appdirs` documentation:
https://pypi.org/project/appdirs/
Resolves the following:
- #351 (use of `sudo` when installing)
- #420 (failure to install on Windows)
- #431 (failure to install on MacOS)
Application now relies on `appdirs` module to identify the appropriate
locations for storing configuration and data, both during installation
and runtime.
Added a missing `termcolor` dependency to `install_requires` in
`setup.py`. `termcolors` was introduced as an optional dependency when
the `CHEAT_HIGHLIGHT` envvar was implemented.
PR #391 changed the locaton into which system-wide cheatsheets are
installed to `/usr/share/cheat`, in order to comply with FHS. However,
this is causing conflicts with the `snap` packaging process.
This commit removes hard-coded references to `/usr/share/cheat` (outside
of `config/cheat`), and instead reads the cheat path via the
`CHEAT_PATH` config value (which may be set either in `cheat/config`, or
exported as an environment variable).
Lastly, this commit makes `setup.py` "aware of" the `CHEAT_PATH` env
var, allowing us to specify to where sytem-wide cheatsheets should be
installed during the `snap` build.
- When using GFM code fences, strip the last line in addition to the
first
- Updated `README.md` to mention the new feature
- `minor` version-bump to `2.2.0`.
pypi responded with an HTTP 500 when uploading the last version of
`cheat`, and this seems to have caused some problems. No changes were
made in this commit other than incrementing the version number in an
attempt to resolve this.
* 'setup-improvements' of https://github.com/youtux/cheat:
Use entry_points instead of scripts in setup.py
Improve setup.py description
Exploit setuptools package_data to include cheats
Use find_packages from setuptools to identify packages
Use setuptools insted of distutils.
Now, whenever a cheatsheet is to be edited, if that cheatsheet does not
exist on the `DEFAULT_SHEET_PATH`, it is first copied there before being
opened for editing. This prevents system-wide cheatsheets from being
edited when using `cheat` as `root`.
- Solves issue whereby global cheatsheets fail to save after editing
- `cheat` no longer asks a user if a global cheatsheet should be copied
locally before editing, and instead just silently does so.
This allows a fine-grained control of the dependencies, because it generates a wrapper script
that calls the specifiend function (i.e., main inside cheat/app.py)