{ "info": { "author": "Mantas Zimnickas", "author_email": "sirexas@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: Unix", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "``pyscripting`` is python module that provides various utilities to make shell\nscripting with python easier.\n\nGetting started\n===============\n\n1. Get ``scripting.py``::\n\n pip install pyscripting\n\n2. Create your python shell script ``myscript.py``::\n\n #!/usr/bin/env python\n\n from scripting import sh\n\n sh.ls('-l')\n\n3. Use your script::\n\n chmod +x myscript.py\n ./myscript.py\n\nCalling external commands\n=========================\n\nThere are three ways to call external commands.\n\nIf possible, python replacement of an external command will be used.\nReplacements will not be used only in direct calling.\n\nFor all replaced commands see `Replaced commands`_.\n\n\nDirect calling\n--------------\n\nReturns exit code.\n\n::\n\n sh('ls', '-l')\n\nIndirect calling\n----------------\n\nReturns exit code.\n\n::\n\n sh.ls('-l')\n\nCall and return output\n----------------------\n\nReturns stripped stdout (stderr will not be included).\n\nUsing this method, output of command will not be printed to stdout. Before\nreturning output, leading white spaces will be stripped.\n\nDon't use this methos for large outputs.\n\n::\n\n output = sh.get('ls', '-l')\n print('Output was: %s' % output)\n\nArgument handling\n=================\n\nYou can access arguments passed to script using ``argv`` property::\n\n sh.argv[0] - called script name\n sh.argv[1] - first argument\n\n.. _Replaced commands:\n\nReplaced commands\n=================\n\nTo avoid overhead and for simplicity reasons, some external commands was\nreplaced by python's internal functions, which works much faster, that calling\nexternal command.\n\n\n``basename``\n Same as external ``basename``.\n\n Returns string.\n\n``exit``\n Same as external ``exit``.\n\n``find``\n Similar to external ``find`` command.\n\n Returns iterator of all found files.\n\n Example usage::\n\n for f in sh.find(type='f', exclude=['*.pyc']):\n print(f)\n\n``mkdir``\n Same as external ``mkdir``.\n\n``mkdirs``\n Same as external ``mkdir -p``.\n\n``test``\n Similar to external ``test``.\n\n Returns boolean.\n\n Example usage::\n\n if sh.test('-d', '/tmp'):\n print('/tmp is directory.')\n\n\nMakefile functionality\n======================\n\nExample (``myscript.py``)::\n\n #!/usr/bin/env python\n\n from scripting import sh, Makefile\n\n make = Makefile(sh)\n\n\n @make('/tmp/myfile.txt')\n def myrule(target):\n sh.touch(target)\n\n @make()\n def main(target):\n myrule()\n\n make.run(main)\n\nLast line ``make.run(main)`` checks ``sys.argv`` and executes specified rule or\ndefault if no particular rule is specified. ``myrule`` will be executed only,\nif target file ``/tmp/myfile.txt`` does not exists.::\n\n ./myscript.py\n\nNow call particular rule::\n\n ./myscript.py myrule", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/sirex/pyscripting/src", "keywords": "shell,scripting", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pyscripting", "package_url": "https://pypi.org/project/pyscripting/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyscripting/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/sirex/pyscripting/src" }, "release_url": "https://pypi.org/project/pyscripting/0.1/", "requires_dist": null, "requires_python": null, "summary": "Shell scripting library for Python", "version": "0.1" }, "last_serial": 797715, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "73941cd16ad7e8152dda6b92623878a5", "sha256": "a7a165e17e308fc0a0e9be4f17b3600f4fdc4c58fd70ae05d7fbf94f91aa8365" }, "downloads": -1, "filename": "pyscripting-0.1.linux-x86_64.exe", "has_sig": false, "md5_digest": "73941cd16ad7e8152dda6b92623878a5", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 68073, "upload_time": "2011-04-20T21:14:46", "url": "https://files.pythonhosted.org/packages/5c/82/1d7cee0cc614a9fd7c5c8ec3eba64720dbf4c8565618c4022f07a061e480/pyscripting-0.1.linux-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "423de0a56d95ee7db33b32df0ac9621f", "sha256": "481d88a58f370b9336891d1bdfa7774c3b670eba98d7ef9f408f16c6a0fbc20c" }, "downloads": -1, "filename": "pyscripting-0.1.tar.gz", "has_sig": false, "md5_digest": "423de0a56d95ee7db33b32df0ac9621f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3599, "upload_time": "2011-04-20T21:14:45", "url": "https://files.pythonhosted.org/packages/fc/3a/df746b5d9ffe287dd21872d3fab845c0056dad33ffc82d391180e07a4b36/pyscripting-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "73941cd16ad7e8152dda6b92623878a5", "sha256": "a7a165e17e308fc0a0e9be4f17b3600f4fdc4c58fd70ae05d7fbf94f91aa8365" }, "downloads": -1, "filename": "pyscripting-0.1.linux-x86_64.exe", "has_sig": false, "md5_digest": "73941cd16ad7e8152dda6b92623878a5", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 68073, "upload_time": "2011-04-20T21:14:46", "url": "https://files.pythonhosted.org/packages/5c/82/1d7cee0cc614a9fd7c5c8ec3eba64720dbf4c8565618c4022f07a061e480/pyscripting-0.1.linux-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "423de0a56d95ee7db33b32df0ac9621f", "sha256": "481d88a58f370b9336891d1bdfa7774c3b670eba98d7ef9f408f16c6a0fbc20c" }, "downloads": -1, "filename": "pyscripting-0.1.tar.gz", "has_sig": false, "md5_digest": "423de0a56d95ee7db33b32df0ac9621f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3599, "upload_time": "2011-04-20T21:14:45", "url": "https://files.pythonhosted.org/packages/fc/3a/df746b5d9ffe287dd21872d3fab845c0056dad33ffc82d391180e07a4b36/pyscripting-0.1.tar.gz" } ] }