Package: greenland
Greenland: Pythonic Infrastructure==================================Greenland is a package that lowers the entry barrier to implementingtasks that are often more typically done in shell scripts.Source code is available from the `git repository`_. See`CHANGELOG.rst`_ for changes and release history... _CHANGELOG.rst:  file:CHANGELOG.rst.. _git repository: https://github.com/m-e-leypold/greenland4The example given below showcases what Greenland purports to solve: Toprovide easily composable building blocks for tasks that occur inareas commonly reserved to shell scripting.Greenland currently is not complete in this respect and will not befor some time. The author regardless wishes users much fun andsuccess, in case they decide to use Greenland.An example----------Assume, you're tasked with writing a utility for cleaning up directorytrees. It should allow th user to provide a pattern and a directorypath, then all files matching this pattern are deleted in thereferenced directory tree, like this:.. code-block:: console$> rm-in-tree '*~' my/dataThe obvious and probably cheapest solution -- if you're fluent in bourne shell and shellutilities, is, to build a shell script around a line like.. code-block:: consolefind "$ROOT" -name "$PATTERN" -print0 | xargs -0 rm -fIt still leaves you with the burden to do some command line parsing inshell script -- which is not overly heavy in this case so far, butspins quickly out of control when the client wants more features, like:- A configuration for the default pattern in the users home directory.- A verbose option to log the parameters given and the files deleted.- A dry-run option to preview what will be deleted.Sooner or later you'll wish you could do that in a real programminglanguage where not all data types are strings that are pasted togetherby arcane expansion rules.So, this would be a case to use in example Python. While handling datain a real programming language is clearly less flakey than in theshell, parsing command lines often still constitutes a major burden,even with helpers already in the standard libraries. This is also truefor Python. And finding files in directory tree is also a bit of aneffort.So what the author of Greenland would have liked is to have in Pythonall the building blocks that one normally has available in shellprogramming, but where possible, better (like in example the commandline parsing, which IMHO turns out to be a mess in practically allappoaches I've seen so far).So, what what the author of Greenland would have liked to have, is adeclarative way of specifying the command line arguments, like in.. literalinclude:: examples/rm-in-tree/rm-in-tree:language: python:start-after: [manual] begin usage:end-before: [manual] end usage:dedent: 4And the author of Greenland would have like to have a simple way toiterate over all the files in a directory tree with a specifiedproperty, like in.. literalinclude:: examples/rm-in-tree/rm-in-tree:language: python:start-after: [manual] begin find_files:end-before: [manual] end find_files:dedent: 8You can also see, how the *dry-run* option has become an object membervariable here. This is done automagically by the Greenland algorithms,except if you specify otherwise.LICENSE-------Greenland is free Software and licensed by the terms of the Gnu PublicLicense, version 3 or later (GPL3).For details and the full license text see the file LICENSE.txt at thetop of the source tree.