Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
commit 4cd404bb79c1be32d1e403fafbbf50546641d2e9 Author: Michal Minar miminar@redhat.com Date: Thu May 22 10:32:50 2014 +0200
scripts: allow for upload to PyPI
Added additional README and setup script that allows uploading of openlmi-scripts (which is deprecated package) to PyPI. This package needs to be preserved for RHEL 7 releases where openlmi-tools do not yet ship LMI Meta-command.
Added makefile generating README.txt file.
Added documentation which just points to openlmi-tools.
cli/Makefile | 12 +++ cli/README-scripts.md | 57 +++++++++++++ cli/doc-scripts/Makefile | 22 +++++ cli/doc-scripts/README | 5 + .../scripts/mylf/doc => cli/doc-scripts}/conf.py | 88 ++++++-------------- cli/doc-scripts/index.rst | 14 +++ cli/setup-scripts.py | 69 +++++++++++++++ 7 files changed, 206 insertions(+), 61 deletions(-)
diff --git a/cli/Makefile b/cli/Makefile new file mode 100644 index 0000000..f9b6e54 --- /dev/null +++ b/cli/Makefile @@ -0,0 +1,12 @@ +SOURCE ?= README.md +TARGET ?= README.txt + +.PHONY: readme + +readme: + pandoc --from=markdown --to=rst -o $(TARGET) $(SOURCE) + +clean: + -rm $(TARGET) + +# ex: ft=make noet sw=8 ts=8 diff --git a/cli/README-scripts.md b/cli/README-scripts.md new file mode 100644 index 0000000..6083fd7 --- /dev/null +++ b/cli/README-scripts.md @@ -0,0 +1,57 @@ +openlmi-scripts +=============== +Client-side python libraries and *LMI Meta-command* for system management +through OpenLMI providers. + +It serves as a base for small python eggs targeted on one or more OpenLMI +providers. We call these eggs scripts. They are installed separately although +they can depend on each other. + +They contain python library itself as well as command line interface. This +interface is registered with *LMI Meta-command* which is a part of OpenLMI +Tools. *LMI Meta-command* loads it and offers to interface with broker through +command line. + +For more information please refer to online documentation on [pythonhosted][]. + +Take a look at [scripts upstream repository][git] for inspiration on how to +write your own scripts. + +### Deprecation warning + +`openlmi-scripts` is deprecated egg. It contains just *LMI Meta-command* which +has been moved to `openlmi-tools` (version `0.9.1`). Newer scripts (`openlmi-scripts-*`) +now depend just on `openlmi-tools`. Use this package only with older *tools*. + +Dependencies +------------ +Code base is written for `python 2.7`. +There are following python dependencies: + + * openlmi-tools >= 0.9 and < 0.9.1 ([PyPI][tools-PyPI]) + * python-docopt + * pandoc + +Installation +------------ +Use standard `setuptools` script for installation: + + $ cd openlmi-scripts/commands/$CMD + $ make setup + $ python setup.py install --user + +This installs particular client library and command line interface for +*LMI Meta-command*. + +Script eggs are also available on *PyPI*, install them with: + + $ # add any provider you want to interact with + $ pip install --user openlmi-scripts-service openlmi-scripts-software + +Check out [this][PyPI] site listing all available script eggs. + +------------------------------------------------------------------------------ +[git]: https://github.com/openlmi/openlmi-scripts "openlmi-scripts" +[pythonhosted]: http://pythonhosted.org/openlmi-tools/index.html "Python Hosted" +[tools-PyPI]: https://pypi.python.org/pypi/openlmi-tools "Tools on PyPI" +[PyPI]: https://pypi.python.org/pypi?%3Aaction=search&term=openlmi-scripts&s... "Scripts on PyPI" diff --git a/cli/doc-scripts/Makefile b/cli/doc-scripts/Makefile new file mode 100644 index 0000000..d59d0f9 --- /dev/null +++ b/cli/doc-scripts/Makefile @@ -0,0 +1,22 @@ +SPHINXOPTS = +SPHINXBUILD ?= sphinx-build +PAPER = +BUILDDIR = _build +SRCDIR = .. + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +PROJECTNAME := OpenLMIScripts + +.PHONY: clean deps + +html: + ${SPHINXBUILD} -b $@ $(ALLSPHINXOPTS) $(BUILDDIR)/$@ + @echo "$@ build finished. Output is in $(BUILDDIR)/$@." + +clean: + rm -r _build diff --git a/cli/doc-scripts/README b/cli/doc-scripts/README new file mode 100644 index 0000000..be4da77 --- /dev/null +++ b/cli/doc-scripts/README @@ -0,0 +1,5 @@ +This documentation is for deprecated openlmi-scripts package which is hosted on +PyPI. It just points to user to follow documentation on openlmi-tools. + +Upload it from parent directory with (after a build): + python setup-scripts.py upload_docs --upload-dir=doc-scripts/_build/html diff --git a/doc/src/scripts/mylf/doc/conf.py b/cli/doc-scripts/conf.py similarity index 77% copy from doc/src/scripts/mylf/doc/conf.py copy to cli/doc-scripts/conf.py index 91e943c..67e679a 100644 --- a/doc/src/scripts/mylf/doc/conf.py +++ b/cli/doc-scripts/conf.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# OpenLMI MyLF scripts documentation build configuration file, created by -# sphinx-quickstart on Wed Oct 2 08:58:25 2013. +# OpenLMI Scripts documentation build configuration file, created by +# sphinx-quickstart on Thu Aug 8 15:36:58 2013. # # This file is execfile()d with the current directory set to its containing dir. # @@ -16,7 +16,7 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('../lmi'))
# -- General configuration -----------------------------------------------------
@@ -25,7 +25,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] +extensions = []
# Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -40,17 +40,17 @@ source_suffix = '.rst' master_doc = 'index'
# General information about the project. -project = u'OpenLMI MyLF scripts' -copyright = u'2013-2014, Red Hat, Inc.' +project = u'OpenLMI Scripts' +copyright = u'2014, Red Hat, Inc.'
# The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.0.1' +version = "0.2.8" # The full version, including alpha/beta/rc tags. -release = '0.0.1' +release = "0.2.8"
# The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "openlmitheme"
# Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -128,7 +128,7 @@ html_static_path = ['_static']
# If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +html_use_smartypants = False
# Custom sidebar templates, maps document names to template names. #html_sidebars = {} @@ -164,7 +164,7 @@ html_static_path = ['_static'] #html_file_suffix = None
# Output file base name for HTML help builder. -htmlhelp_basename = 'OpenLMIMyLFscriptsdoc' +htmlhelp_basename = 'OpenLMIScriptsdoc'
# -- Options for LaTeX output -------------------------------------------------- @@ -183,8 +183,11 @@ latex_elements = { # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'OpenLMIMyLFscripts.tex', u'OpenLMI MyLF scripts Documentation', - u'Michal', 'manual'), + ( 'index' + , 'OpenLMIScripts.tex' + , u'OpenLMI Scripts Documentation' + , u'Red Hat, Inc.' + , 'manual'), ]
# The name of an image file (relative to this directory) to place at the top of @@ -213,8 +216,11 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'openlmimylfscripts', u'OpenLMI MyLF scripts Documentation', - [u'Michal'], 1) + ( 'index' + , 'openlmiscripts' + , u'OpenLMI Scripts Documentation' + , [u'Red Hat, Inc.'] + , 1) ]
# If true, show URL addresses after external links. @@ -227,9 +233,12 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'OpenLMIMyLFscripts', u'OpenLMI MyLF scripts Documentation', - u'Michal', 'OpenLMIMyLFscripts', 'One line description of project.', - 'Miscellaneous'), + ( 'index', 'OpenLMIScripts' + , u'OpenLMI Scripts Documentation' + , u'Red Hat, Inc.' + , 'OpenLMIScripts' + , 'One line description of project.' + , 'Miscellaneous'), ]
# Documents to append as an appendix to all manuals. @@ -240,46 +249,3 @@ texinfo_documents = [
# How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' - - -# -- Options for Epub output --------------------------------------------------- - -# Bibliographic Dublin Core info. -epub_title = u'OpenLMI MyLF scripts' -epub_author = u'Michal' -epub_publisher = u'Michal' -epub_copyright = u'2013-2014, Red Hat, Inc.' - -# The language of the text. It defaults to the language option -# or en if the language is not set. -#epub_language = '' - -# The scheme of the identifier. Typical schemes are ISBN or URL. -#epub_scheme = '' - -# The unique identifier of the text. This can be a ISBN number -# or the project homepage. -#epub_identifier = '' - -# A unique identification for the text. -#epub_uid = '' - -# A tuple containing the cover image and cover page html template filenames. -#epub_cover = () - -# HTML files that should be inserted before the pages created by sphinx. -# The format is a list of tuples containing the path and title. -#epub_pre_files = [] - -# HTML files shat should be inserted after the pages created by sphinx. -# The format is a list of tuples containing the path and title. -#epub_post_files = [] - -# A list of files that should not be packed into the epub file. -#epub_exclude_files = [] - -# The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 - -# Allow duplicate toc entries. -#epub_tocdup = True diff --git a/cli/doc-scripts/index.rst b/cli/doc-scripts/index.rst new file mode 100644 index 0000000..3ded209 --- /dev/null +++ b/cli/doc-scripts/index.rst @@ -0,0 +1,14 @@ +OpenLMI Scripts documentation +============================= + +OpenLMI Scripts comprises of *LMI Meta-command* and a collection of small +python libraries with command-line wrappers. + +.. warning:: + *LMI Meta-command* has been moved into *OpenLMI Tools*, where it logically + belongs, in version 0.2.8. Feature releases of `openlmi-scripts` package on + RHEL will lack this application as well. This package will be just a + collection of scripts. + +Continue to a documentation of mine successor at http://pythonhosted.org/openlmi-tools/ + diff --git a/cli/setup-scripts.py b/cli/setup-scripts.py new file mode 100644 index 0000000..9de046b --- /dev/null +++ b/cli/setup-scripts.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# openlmi-scripts is deprecated egg. It shall be used just on distros with +# older openlmi-tools (older than 0.9.1) without LMI Meta-command. + +import os +import subprocess +import sys +from setuptools import setup, find_packages + +long_description = '' +try: + try: + script_dir = os.path.dirname(sys.argv[0]) + cmd = ['/usr/bin/make', 'readme', 'SOURCE=README-scripts.md'] + readme_file = 'README.txt' + if script_dir not in (',', ''): + cmd[1:1] = ['-C', script_dir] + readme_file = os.path.join(script_dir, readme_file) + with open('/dev/null', 'w') as null: + ret = subprocess.call(cmd, stdout=null, stderr=null) + if not ret: + long_description = open(readme_file, 'rt').read() + except Exception as err: + sys.stderr.write('ERROR while reading README.txt: %s\n' % str(err)) + if not long_description: + long_description = open('README-scripts.md', 'rt').read() +except IOError: + pass + +setup( + name='openlmi-scripts', + version='0.2.8', + description='Client-side library and command-line client', + long_description=long_description, + author='Michal Minar', + author_email='miminar@redhat.com', + url="http://fedorahosted.org/openlmi/", + platforms=['Any'], + license="GPLv2+", + classifiers=[ + 'License :: OSI Approved :: GPLv2+ License', + 'Operating System :: POSIX :: Linux', + 'Topic :: System :: Systems Administration', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Intended Audience :: Developers', + 'Environment :: Console', + ], + + namespace_packages=['lmi', 'lmi.scripts'], + packages=[ + 'lmi', + 'lmi.scripts', + 'lmi.scripts.common', + 'lmi.scripts.common.command', + 'lmi.scripts.common.formatter', + 'lmi.scripts._metacommand'], + install_requires=['openlmi-tools >= 0.9, < 0.9.1', 'docopt >= 0.6'], + include_package_data=True, + zip_safe=False, + entry_points={ + 'console_scripts': [ + 'lmi = lmi.scripts._metacommand:main' + ], + 'lmi.scripts.cmd': [], + }, + )
cura-tools-devel@lists.fedorahosted.org