{ "info": { "author": "limodou", "author_email": "limodou@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "![ci](https://travis-ci.org/limodou/ido.svg?branch=master)\n\n# ido\n\n## What's it?\n\nido is a command line tool, written in Python, and you can use it to install packages or\nexecute commands. It works like brew, yum, apt-get, etc.\nBut ido can be more easily used and extended to suit your needs.\n\n## Features\n\n* Simple core\n* Color command output\n* Packages or commands collection should be organized in a directory or a python format file\n* Installation script file is common Python source file, but the filename extension should be `.ido`\n* Installation script can be searched from local disk or net\n* Builtin rich functions and you can easily extend\n* Packages installation aim user home first\n* Depends files can be searched from disk\n* User can create tool themselves based on ido to suit for their application needs\n* Some configuration can be saved in settings.py\n* Written in Python, should be support 2.6, 2.7, 3.3, 3.4\n\n## Install\n\n```\npip install ido\n```\n\nThis will only include the examples packages, such as demo, zlib, nginx, redis, etc.\n\n## Requirement\n\nido needs: The `future`, `colorama`, `requests` packages, and they be installed automatically.\n\nido currently supports Python 2.6+.\n\n## Usage\n\n### Install a package\n\n```\nido install package\n```\n\n`package` is a name which you want to install to your environment. You can\ntry `ido install demo` see the demo package.\n\nThe usage of this command is:\n\n```\nido help install\n\nUsage: ido install [options] [package, package...]\n\nInstall or execute a pacage\n\nOptions:\n -i INDEX, --index=INDEX\n Package index link, it can be a directory or an url.\n -E ENV_VAR Define variables and will passed to installation\n scripts.\n -p PREFIX, --prefix=PREFIX\n Prefix value when compile and install source packages.\n -l LOG, --log=LOG Log filename the shell outut will be written in it.\n -f FILES, --files=FILES\n Source packages storage directory.\n --nocolor Output result without color.\n -c CONFIG, --config=CONFIG\n Config file.\n```\n\n\n#### View a package installation script\n\n```\nido view package\n```\n\nView the given package install.py content in editor or just display to console\n(with `-d` option in command line).\n\n```\nido help view\n\nUsage: ido view [options] package\n\nView install.py of a package\n\nOptions:\n -i INDEX, --index=INDEX\n Package index link, it can be a directory or an url.\n -e EDITOR, --editor=EDITOR\n Editor used to open install.py of the package.\n -d, --display Just display install.py content but not edit it.\n --nocolor Output result without color.\n```\n\n### Package install script\n\nA package should have a directory named `` and in it there must be a file called `install.py`.\nOr just a python file which named `.py`.\nDo you can write script just with python at all.\n\nThe `install.py` is just a common python file, but it'll be executed with `exec()`,\nand ido will pass some builtin variables such as:\n\n* BUILD The value will be '/tmp/ido_packages_build', and it'll used to compile source packages.\n* PREFIX Can be passed in command line option `-p` or `--prefix` , or defined in environment\n variable `IDO_PREFIX`, and script can use it as value of `./configure --prefix`.\n* HOME Current user HOME directory.\n\nThere are also some builtin functions, objects or modules, such as:\n\n* Modules\n * os\n * sys\n* Functions\n * `sh()` Used to execute shell command, `sh('ls')`\n * `cd()` Used to change current directory, `cd(BUILD)`\n * `mkdir()` Used to make directories, `mkdir('/tmp/a/b')`\n * `wget()` Used to download a file from internet, `wget('http://zlib.net/zlib-1.2.8.tar.gz')`\n * `cp()` Used to copy a source file(can use fnmatch to match the filename) to destination directory or file, `cp('zlib*', BUILD)`\n * `install()` Used to install other package, `install('zlib')`\n * `message()` Used to output colored message, `message(msg, 'error')`, the second argument\n will be `error`, `info`, `prompt`, `cmd` or just omitted.\n * `tarx()` Used to execute untar a tarball file, `tarx('a.tar.gz')`\n * `unzip()` Used to uncompress zip file, `unzip('a.zip')`\n * `pip()` Used to call pip tool to install package\n\n* Color Objects\n * `Fore`, `Back`, `Style` They are colorama objects, so you can use them directly.\n\n### Packages Index\n\nPackages should be saved in a directory, I called it `index`, and ido can search package from them. ido\ncan support multiple source of index, the default is shipped in ido package, it's `ido/packages`\nAnd ido also support other local directoires or url links, so you can pass them in command\nline just like:\n\n```\nido install zlib -i ~/packages\nido install zlib -i https://yourname/packages (Not implemented yet)\nido install zlib -i ~/packages -i https://yourname/packages\n```\n\nYou can also defined in environment variable `IDO_INDEXES`, so the searching order is:\n\n1. command line argument\n1. settings file\n1. environment variable\n1. default `ido/packages`\n\n### Command options\n\nYou can just type:\n\n```\nido\n#or\nido help\n```\n\nto see the help messages.\n\n### Pass variables to script\n\nIf you have some variables and want to pass them to install script, so you can define them\nin command argument, eg:\n\n```\nido install zlib -Evar1=demo1 -Evar2=demo2\n```\n\n### See exception\n\nSometimes the script will throw exceptions, but they'll be hidden by default, and if you want\nto see them you can just pass `-v` to see them.\n\n## Build your own packages system\n\nFor now, ido ships with only a few packages, so it seems that it's useless. But you can use it\nto build your own packages system, to make it useful.\n\nYou can give index url or directory like this:\n\n```\nido install yourpackage -i local_directory -i http://remote_url\n```\n\nSo you can make packages in index directory and install them as you wish.\n\n## zlib demo\n\nThere is already some basic or demo packages in ido, such as zlib, you can find\nit at `ido/packages/zlib` , and there is an `install.py` file in it. The content\nis :\n\n```\nfilename = cp('zlib*', BUILD, wget='http://zlib.net/zlib-1.2.8.tar.gz')\ncd(BUILD)\ncd(tar(filename))\nsh('./configure --prefix=%s' % PREFIX)\nsh('make install')\n```\n\nThis demo shows how to copy zlib file to build directory, and if not existed, it'll\ndownload zlib file from internet, then compile it, and install it. Functions\nlike `cp`, `sh`, `cd`, `tar` is builtin functions you can\nuse directly. `BUILD` , `PREFIX` is builtin variables which you can also use directly.\n\nIn order to compatible with `call` command, you could wrap the script with a `cal()` function,\njust like:\n\n```\ndef call(args, options):\n filename = cp('zlib*', BUILD, wget='http://zlib.net/zlib-1.2.8.tar.gz')\n cd(BUILD)\n cd(tar(filename))\n sh('./configure --prefix=%s' % PREFIX)\n sh('make install')\n```\n\nSo that you could define command line options in it and call it via `ido call package`.\n\nThere different between them is: `install` can install multi packages, and with no options.\nBut `call` can only install one package, but you could provide options to it. So for simple\nscript, `install` is enough, but for complex script, you could use `call`.\n\n## Builtin Funtions\n\n### wget\n\n```\ndef wget(filename, in_path=None) -> filename\n```\n\nIt'll try to download the remote file. But ido also can cache the downloaded file in\n`FILES` directory. So if a file is already\ndownloaded, it'll not download it again. And you can also give `in_path`\nparameter to wget function or just give `-f files_directory`\nin the command line, ido will also search files in these directories, so the order of search\na filename which need to be downloaded is:\n\n1. `in_path` parameter directory\n1. directory of `-f` parameter of command line\n\nIF wget download or just find an existed file, it'll return the real filename of it, so\nyou can use the returned filename later.\n\n### cp\n\n```\ndef cp(src, dst, in_path=None, wget=None) -> filename\n```\n\nIt'll copy source file to destination directory. And it also supports filename pattern\nlike: `'zlib*'`, etc. If the source filename is relative, it'll search the file according\nto `in_path` or `-f` parameter of command line. And if the filename is not found, then\nit'll use `wget` command to download according `wget` parameter, for example:\n\n```\nfilename = cp('zlib*', BUILD, wget='http://zlib.net/zlib-1.2.8.tar.gz')\n```\n\nIf the command is successful, it'll only return the basename of the filen. For example: `zlib-1.2.8.tar.gz`\nwithout the path.\n\n### sh\n\n```\ndef sh(cmd)\n```\n\nIt'll execute the command line in a shell.\n\n### cd\n\n```\ndef cd(path)\n```\n\nChanges current directory to `path`. And it also support `with` statement, for example:\n\n```\nwith cd('/tmp'):\n #do\n#it'll change back to old path\n```\n\n### mkdir\n\n```\ndef mkdir(path)\n```\n\nIt'll check if the `path` is already existed, if not then make directories using `os.makedirs`\n\n### tarx\n\n```\ndef tarx(filename, flags='xvfz')\n```\n\nIt'll extract tarball file to current directory, if you want to create tarbar file,\nyou should use `sh('tar cvfz test.tar.gz files')` command.\n\nAnd it'll return the extracted directory after extracing the tarbar file. So you can change\ndirctory after extract tarbar easily `cd(tarx(filename))`\n\n### unzip\n\n```\ndef unzip(filename, flags='')\n```\n\nIt'll extract zip file to current directory, if you want to create zip file,\nyou should use `sh('zip zipfile files')` command.\n\nAnd it'll return the extracted directory after extracing the zip file. So you can change\ndirctory after extract tarbar easily `cd(unzip(filename))`\n\nIt'll automatically add `-o` (overwrite exsited files) for you, so if you don't like\nthese, you should use `sh('unzip zipfile')`\n\n### pip\n\n```\ndef pip(packages, index=None, requirements=None)\n```\n\nIt'll use pip command tool to install python packages. `packages` can be a tuple, list or just\nsingle package name, for example:\n\n```\npip(['uliweb', 'plugs'])\npip('uliweb')\n```\n\nBy default, pip will use local diretory to find the packages, so you should pass `-f` parameter\nin the command line, if you don't pass it, the default package directory will be current directory.\nAnd pip() will try to install packages in files directory, if it fails, it'll try to download\nthe package and saved them in files directory, and install it again. So after execute pip()\nfunction, the package file will be found in files directory.\n\nAnd you can also pass it `requirements` parameter, it'll use `pip install -r requirements.txt`\ncommand line to install it, and it'll try to install in locally first, if failed, it'll try to\ninstall with index.\n\n```\npip(requirements='requirements.txt')\n```\n\n## Settings\n\nSome global vairables can be also saved in a settings file, you can use `-c /path/settings.py`\nto specify a settings file otherwise it'll use `~/.ido/settings.py` by default. And you should\nknow, after you first installed ido, there should not be a default settings.py, so you should\ngive it through command line option or create it in `~/.ido` by yourself.\n\nSettings file is a pure python file, and the content of it should look like:\n\n```\nINDEXES = []\nPREFIX = '$HOME/env'\nFILES = '$HOME/files'\nPRE_LOAD = [('sh', 'SH')]\n```\n\n`PREFIX` and `FILES` just like the environment variables `IDO_PREFIX` and `IDO_FILES` or command\nline options `-p --prefix` and `-f --files`.\n\n`PRE_LOAD` used to pretend import some object from given module path, the example above menas:\nimport `sh` module and alias it as `SH` , so that you can use `SH` directly in your installation\nscript.\n\nAnd the format of `PRE_LOAD` could be:\n\n```\nPRE_LOAD = [\n ('module_path', 'alias_name'),\n ('module_path', '*'),\n ('module_path', ['a', 'b']),\n]\n```\n\nThe example above demonstrates three formats:\n\n1. import `module_path` and alias it as `alias_name`, for example: ('os.path', 'PATH')\n2. import `module_path` and add objects which defined in `__all__` to script namespace\n3. import `module_path` and only add objects `a` and `b` to script namespace\n\nSo if you have third party module want to used in script, you can do like above.\n\nThere is an example settings file in ido source named `settings.py.example`\n\n## Searching and Create Index\n\nIf you don't know if there is a package which you want to install, you could use\n\n```\nido search pattern\n```\n\nHere `pattern` could be a complete package name or substring of a package name. Using\nthis command, there should be an `index.txt` file exsisted in package directory, it's just\na plain text file, and each package should be a line in it. When searching, it'll skip\n`_` beginned name, such as `_init.py`\n\nFor `index.txt` you can create by hand, or you can run `ido createindex [package_directory]`,\nido will created for you. If you omit the `package_directory` argument, it'll search `packages`\ndiretory of ido installation directory, anc save `index.txt` in it.\n\n## Run package installation script with arguments\n\nIf you want to install a package with some customized arguments, so how to do that?\n\nFirst, you should change your script just like:\n\n```\nusage = '[options] args'\noption_list = (\n make_option('-t', '--test', dest='test',\n help='Test.'),\n)\n\ndef call(args, options):\n print (args)\n print (options.test)\n```\n\nYou should define `option_list`, it just uses optparse module to make options, so `make_option`\nwill imported automatically, you can directly use it. And you can also define `usage` to\ndescription the usage of this command.\n\nThen, you should define a function named `call(args, options)`, it just like you invoke\n`options, args= parser.parser_args(argv)`\n\nAnd if you want to see the options of a package script, you could:\n\n```\nido info test_call\n```\n\nThe result should look like:\n\n```\n--> Help package test_call\nUsage: ido call test_call [options] args\n\nOptions:\n -t TEST, --test=TEST Test.\n```\n\nYou should know, the code of `install` and `call` is different a bit. But you can always write\nyour code in `def call(args, options):` function.\n\n## Builtin Packages\n\n* ido_init It'll create BUILD directory, and output the environment variables\n* demo A demo package\n* nginx Install nginx via source\n* redis Install redis via source\n* zlib Install redis via zlib\n\n## License\n\nNew BSD\n\n## Change Log\n\n* 0.1\n * First release\n* 0.2\n * Improve cd function, supports `with` statement\n * Index could be a link, so you can execute command from net\n * Improve `tarx` and `unzip`\n * Improve `cp`, add `wget` parameter, so if file not found, it'll download according `wget`\n parameter via `wget` tool\n * Add settings config support\n * Add `nginx`, `pcre`, `redis` examples\n* 0.3\n * Add `search` and `createindex` subcommands, you can create an index file to a\n packages directory, and use `ido search package` to search if the package existed\n * Add `call` and `info` subcommands, you can make command options to a package script\n* 0.3.1\n * Add `usage` definition in script\n * Fix relative for PREFIX, FILES etc bug #4\n* 0.4\n * Refactor py2&3 compatiable layout with _compat.py\n* 0.5\n * Change installation script filename extension from `.py` to `.ido`\n * ido will search current directory by default, so you can run `ido install your.ido` directly\n * Remove cache option, and you should use files option always.\n * Add `pip()` function", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/limodou/ido", "keywords": "command tools", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "ido", "package_url": "https://pypi.org/project/ido/", "platform": "any", "project_url": "https://pypi.org/project/ido/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/limodou/ido" }, "release_url": "https://pypi.org/project/ido/0.5/", "requires_dist": null, "requires_python": null, "summary": "A command tool used to install packages and execute commands.", "version": "0.5" }, "last_serial": 1145788, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "550b2c74caa534b4ca9e634a288084d7", "sha256": "234604d5e381491a6c29463612cc43262bc863db4ba1b42fb2942b2dea511839" }, "downloads": -1, "filename": "ido-0.1.tar.gz", "has_sig": false, "md5_digest": "550b2c74caa534b4ca9e634a288084d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12061, "upload_time": "2014-06-15T05:08:44", "url": "https://files.pythonhosted.org/packages/29/8a/cf62c52f424c2638c264ca1b4f2c9e53f07fd980270edba6dc22fe745fdf/ido-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "5eefc7614a3ef7b4c23b2aa07306890a", "sha256": "83b62f7b02efe7b2713a452ef26da86a0945558d1a086f5e32f0bb77865e4fdd" }, "downloads": -1, "filename": "ido-0.2.tar.gz", "has_sig": false, "md5_digest": "5eefc7614a3ef7b4c23b2aa07306890a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17878, "upload_time": "2014-06-20T09:01:52", "url": "https://files.pythonhosted.org/packages/20/a7/210246dcb3c32e003ac0f75e46530f67974da255d9e38195526c45bdb7c4/ido-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "d5be2597aaebd642bbfb025c409577f4", "sha256": "f261ffe8574895bc1a9ef1fbad6990a26b1da970bc44cdce6cc8135d447962b5" }, "downloads": -1, "filename": "ido-0.3.tar.gz", "has_sig": false, "md5_digest": "d5be2597aaebd642bbfb025c409577f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20168, "upload_time": "2014-06-22T07:53:49", "url": "https://files.pythonhosted.org/packages/a5/11/3b5f66fae1f2facfe3776213d61dfdd87bc02e55ae4394db1c9d269d518d/ido-0.3.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "bd517d3954df88e5a9ac2f91a6bcb7e8", "sha256": "2e75c8ab4156c7c1530a0f230daba5835cca14778874426343cdcaee6005cf6d" }, "downloads": -1, "filename": "ido-0.5.tar.gz", "has_sig": false, "md5_digest": "bd517d3954df88e5a9ac2f91a6bcb7e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23594, "upload_time": "2014-07-03T07:43:14", "url": "https://files.pythonhosted.org/packages/5e/a4/2ab2fcc53e2b7b5b246d16912b5fe1cd258f6e9725df73c0bdc84dea7d0b/ido-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bd517d3954df88e5a9ac2f91a6bcb7e8", "sha256": "2e75c8ab4156c7c1530a0f230daba5835cca14778874426343cdcaee6005cf6d" }, "downloads": -1, "filename": "ido-0.5.tar.gz", "has_sig": false, "md5_digest": "bd517d3954df88e5a9ac2f91a6bcb7e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23594, "upload_time": "2014-07-03T07:43:14", "url": "https://files.pythonhosted.org/packages/5e/a4/2ab2fcc53e2b7b5b246d16912b5fe1cd258f6e9725df73c0bdc84dea7d0b/ido-0.5.tar.gz" } ] }