Skip to content

Commit

Permalink
Simplify grass init script (#5)
Browse files Browse the repository at this point in the history
* shutil.rmtree removes directories recursively and has ignore errors, so no need for the wrapper
function/classes

* lib/init/grass: Simplify encode()/decode() functions.

* lib/init/grass: Move all the imports at the beginning of the file.

* lib/init/grass: Simplify clean_env().

"clean_env()" is only being called once. Even if it gets called multiple
times in the future, it is unlikely that it will be used with a different
"gisrc".

* Just keeping globals and the initialization stuff at the beginning of the
module

* lib/init/grass: Group the logging functions together.

* lib/init/grass: Move the info message out of the "show_info()" function.

This was messing up with the vim code folding.

* lib/init/grass: Remove unused constants

* lib/init/grass: Remove old comment about removed nested session test

The comment is from 2015. If there were problems, they would have surfaced
since then.

* lib/init/grass: Move all the gisbase stuff in a single place.

* lib/init/grass: Capitalize all constants

* lib/init/grass: Simplify setting a value to CONFIG_PROJSHARE

* lib/init/grass: Add comments about GISBASE

* lib/init/grass: Validate cmdline in a separate function

* lib/init/grass: Inline variable substitution inside "help_message()"

The main motivation here is to avoid making "_()" calls at the module
level which will hopefully let us remove the early "gettext.install()"
call in a later commit.

* lib/init/grass: Refuse to start if ~/.grass7 exists but is not a directory

* lib/init/grass: Ensure that the init process only happens inside main()

1. we remove the "gettext.install()" call from the module level
2. we make sure that "set_language()" is the first step of the init process.

* lib/init/grass: Use six for cross version Python compatibility

Six is being pulled by matplotlib anyway, but for good measure,
I also added it to the explicit requirements.
  • Loading branch information
pmav99 authored and wenzeslaus committed Jul 25, 2019
1 parent 5249e44 commit 2246f5b
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 255 deletions.
4 changes: 4 additions & 0 deletions REQUIREMENTS.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ <h3>Optional packages:</h3>
<a href="https://pypi.python.org/pypi/termcolor">https://pypi.python.org/pypi/termcolor</a>
</li>

<li><b>six</b> (needed for cross-version Python compatibility)<br>
<a href="https://pypi.python.org/pypi/six">https://pypi.python.org/pypi/six</a>
</li>

<li><b>FFMPEG or alternative</b> (for wxGUI Animation tool - g.gui.module),
specifically ffmpeg tool<br>
<a href="http://ffmpeg.org">http://ffmpeg.org</a>
Expand Down
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
"python-numpy",
"python-ply",
"python-pil",
"python-six",
"libnetcdf-dev",
"netcdf-bin",
"libblas-dev",
Expand Down
Loading

0 comments on commit 2246f5b

Please sign in to comment.