emacs-python-environment-0.0.2/0000755000175000017500000000000012477530362016325 5ustar dogslegdogslegemacs-python-environment-0.0.2/doc/0000755000175000017500000000000012477530362017072 5ustar dogslegdogslegemacs-python-environment-0.0.2/doc/requirements.txt0000644000175000017500000000011412477530362022352 0ustar dogslegdogsleggit+https://github.com/flycheck/sphinxcontrib-emacs#egg=sphinxcontrib-emacs emacs-python-environment-0.0.2/doc/Makefile0000644000175000017500000001526312477530362020541 0ustar dogslegdogsleg# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/EmacsPythonEnvironment.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/EmacsPythonEnvironment.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/EmacsPythonEnvironment" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/EmacsPythonEnvironment" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." emacs-python-environment-0.0.2/doc/source/0000755000175000017500000000000012477530362020372 5ustar dogslegdogslegemacs-python-environment-0.0.2/doc/source/conf.py0000644000175000017500000002045012477530362021672 0ustar dogslegdogsleg# -*- coding: utf-8 -*- # # Emacs Python Environment documentation build configuration file, created by # sphinx-quickstart on Thu Mar 13 19:36:29 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import 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('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # 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.intersphinx', 'sphinxcontrib.emacs', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Emacs Python Environment' copyright = u'2014, Takafumi Arakaki' # 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.2' # The full version, including alpha/beta/rc tags. release = '0.0.2alpha0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False highlight_language = 'cl' # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # 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 # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'EmacsPythonEnvironmentdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto/manual]). latex_documents = [ ('index', 'EmacsPythonEnvironment.tex', u'Emacs Python Environment Documentation', u'Takafumi Arakaki', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'emacspythonenvironment', u'Emacs Python Environment Documentation', [u'Takafumi Arakaki'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'EmacsPythonEnvironment', u'Emacs Python Environment Documentation', u'Takafumi Arakaki', 'EmacsPythonEnvironment', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} # -- Options for Emacs ---------------------------------------------------- emacs_lisp_load_path = [os.path.abspath(os.path.join('..', '..',))] emacs-python-environment-0.0.2/doc/source/index.rst0000644000175000017500000000160012477530362022230 0ustar dogslegdogsleg.. include:: ../../README.rst .. el:require:: python-environment End user configuration ====================== The following variables are set by end users. Emacs plugin authors *must not* set or let-bind these variables. .. el:variable:: python-environment-directory :auto: .. el:variable:: python-environment-default-root-name :auto: .. el:variable:: python-environment-virtualenv :auto: API functions ============= .. el:function:: python-environment-make :auto: .. el:function:: python-environment-make-block :auto: .. el:function:: python-environment-run :auto: .. el:function:: python-environment-run-block :auto: .. el:function:: python-environment-exists-p :auto: .. el:function:: python-environment-bin :auto: .. el:function:: python-environment-lib :auto: Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` emacs-python-environment-0.0.2/doc/make.bat0000644000175000017500000001512612477530362020504 0ustar dogslegdogsleg@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source set I18NSPHINXOPTS=%SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\EmacsPythonEnvironment.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\EmacsPythonEnvironment.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end emacs-python-environment-0.0.2/README.rst0000644000175000017500000000440112477530362020013 0ustar dogslegdogsleg====================================== Python virtualenv API for Emacs Lisp ====================================== .. sidebar:: Links: * `Repository `_ (at GitHub) * `Issue tracker `_ (at GitHub) * `Travis CI `_ |build-status| * `MELPA `_ |melpa-badge| * `MELPA Stable `_ |melpa-stable-badge| Emacs integrates well with external tools written in languages other than Emacs Lisp and thus use of these tools should be encouraged. However, many people try to avoid using non-Emacs Lisp software tools since it makes installation of their Emacs plugin hard. python-environment.el solves this problem (only for the case the tool is written in Python) by providing virtualenv API in Emacs Lisp so that you can automate installation of tools written in Python. Let's say you write Emacs plugin which uses Python script. Then you would want to setup Python modules for that script easily from Emacs. This is how to do that using python-environment.el .. code :: cl (require 'python-environment) (defun YOUR-PLUGIN-install-python-dependencies () (interactive) (python-environment-run "pip" "install" "epc")) In your plugin, if you want the path to command installed in the virtualenv, do something like this .. code :: cl (start-process NAME BUFFER (python-environment-bin "COMMAND") ...) Path to access COMMAND may be different in \*nix and in Windows, but python-environment.el finds the right path. .. Build status badge .. |build-status| image:: https://secure.travis-ci.org/tkf/emacs-python-environment.png ?branch=master :target: http://travis-ci.org/tkf/emacs-python-environment :alt: Build Status .. |melpa-badge| image:: http://melpa.org/packages/python-environment-badge.svg :target: http://melpa.org/#/python-environment :alt: MELPA Badge .. |melpa-stable-badge| image:: http://stable.melpa.org/packages/python-environment-badge.svg :target: http://stable.melpa.org/#/python-environment :alt: MELPA Stable Badge emacs-python-environment-0.0.2/test-python-environment.el0000644000175000017500000001675412477530362023524 0ustar dogslegdogsleg;;; test-python-environment.el --- Tests for python-environment.el ;; Copyright (C) 2013 Takafumi Arakaki ;; Author: Takafumi Arakaki ;; This file is NOT part of GNU Emacs. ;; test-python-environment.el is free software: you can redistribute ;; it and/or modify it under the terms of the GNU General Public ;; License as published by the Free Software Foundation, either ;; version 3 of the License, or (at your option) any later version. ;; test-python-environment.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with test-python-environment.el. ;; If not, see . ;;; Commentary: ;; ;;; Code: (require 'ert) (require 'python-environment) (defmacro pye-test-with-temp-env (&rest body) (declare (debug (&rest form)) (indent 0)) (let ((path (make-symbol "path"))) `(let* ((,path (make-temp-file "pye-test-" t)) (python-environment-directory ,path)) (unwind-protect (progn ,@body) (delete-directory ,path t))))) (defmacro pye-deftest (name args &rest body) "Customized `ert-deftest'. Bind `python-environment-directory' to a temporary directory while executing BODY." (declare (debug (&define :name test name sexp [&optional stringp] [&rest keywordp sexp] def-body)) (doc-string 3) (indent 2)) `(ert-deftest ,name ,args (pye-test-with-temp-env ,@body))) (defmacro pye-with-mixed-environment (environment &rest body) "Mix-in ENVIRONMENT to `process-environment' while executing `BODY'. ENVIRONMENT is a list whose element is arguments (i.e., list) to `setenv'." (declare (debug (sexp &rest form)) (indent 1)) `(let ((process-environment (mapcar #'identity process-environment))) (mapc (lambda (env) (apply #'setenv env)) ,environment) ,@body)) (defun pye-eval-in-subprocess (sexp &optional environment) "Evaluate SEXP in Emacs launched as subprocess. Additional environment variable can be given as ENVIRONMENT (see `pye-with-mixed-environment')." (let ((default-directory (expand-file-name default-directory))) ;; Resolution of "~/" will be affected by `environment' if it ;; includes "$HOME". So expand it before ;; `pye-with-mixed-environment' to avoid the confusion. (pye-with-mixed-environment environment (let ((print-length nil) (print-level nil)) (with-temp-buffer (let ((code (call-process (concat invocation-directory invocation-name) nil t nil "-Q" "--batch" "--eval" (format "(setq load-path (cons %S '%S))" default-directory load-path) "--load" (locate-library "test-python-environment") "--eval" (format "%S" sexp)))) (unless (eq code 0) (error "Subprocess terminated with code %S.\nOutput:\n%s" code (buffer-string))))))))) (defmacro pye-test-with-capture-message (&rest form) (declare (debug (&rest form)) (indent 0)) `(let ((start (make-marker)) (message-buffer (get-buffer "*Messages*"))) (with-current-buffer message-buffer (set-marker start (point-max))) (progn ,@form) (with-current-buffer message-buffer (buffer-substring start (point-max))))) (ert-deftest pye-test-test-with-capture-message () (should (equal (pye-test-with-capture-message (message "test-1") (message "test-2")) "test-1\ntest-2\n"))) (defun pye-test-proc-runner-output-message (proc-runner desired-output) (let* ((command '("echo" "DUMMY-ECHO-MESSAGE")) (python-environment--verbose t) (message-output (pye-test-with-capture-message (funcall proc-runner "DUMMY-MESSAGE" command)))) (should (equal message-output desired-output)))) (ert-deftest pye-test-deferred-process-output-message () (pye-test-proc-runner-output-message (lambda (msg command) (deferred:sync! (python-environment--deferred-process msg command))) "\ DUMMY-MESSAGE...Done DUMMY-ECHO-MESSAGE ")) (ert-deftest pye-test-blocking-process-output-message () (pye-test-proc-runner-output-message #'python-environment--blocking-process "\ DUMMY-MESSAGE (SYNC)... DUMMY-ECHO-MESSAGE DUMMY-MESSAGE (SYNC)...Done ")) (defun pye-test-deferred-process-should-error () (let (err) (deferred:sync! (deferred:error (python-environment--deferred-process "DUMMY-MESSAGE" '("false")) (lambda (got) (setq err got)))) (should err))) (ert-deftest pye-test-deferred-process-error-without-verbose () (let ((python-environment--verbose nil)) (pye-test-deferred-process-should-error))) (ert-deftest pye-test-deferred-process-noerror-without-verbose () (let ((python-environment--verbose nil)) (deferred:sync! (python-environment--deferred-process "DUMMY-MESSAGE" '("true"))))) (ert-deftest pye-test-blocking-process-error-without-verbose () (let ((python-environment--verbose nil)) (should-error (python-environment--blocking-process "DUMMY-MESSAGE" '("false"))))) (ert-deftest pye-test-blocking-process-noerror-without-verbose () (let ((python-environment--verbose nil)) (python-environment--blocking-process "DUMMY-MESSAGE" '("true")))) (ert-deftest pye-test-deferred-process-error-with-verbose () (let ((python-environment--verbose t)) (pye-test-deferred-process-should-error))) (ert-deftest pye-test-deferred-process-noerror-with-verbose () (let ((python-environment--verbose t)) (deferred:sync! (python-environment--deferred-process "DUMMY-MESSAGE" '("true"))))) (ert-deftest pye-test-blocking-process-error-with-verbose () (let ((python-environment--verbose t)) (should-error (python-environment--blocking-process "DUMMY-MESSAGE" '("false"))))) (ert-deftest pye-test-blocking-process-noerror-with-verbose () (let ((python-environment--verbose t)) (python-environment--blocking-process "DUMMY-MESSAGE" '("true")))) (pye-deftest pye-test-make-environment-with-non-existing-command () (should-error (python-environment-make nil '("non-existing-command")))) (pye-deftest pye-test-make-environment () (deferred:sync! (python-environment-make))) (pye-deftest pye-test-run () (deferred:sync! (python-environment-run '("python" "--version")))) (pye-deftest pye-test-run-block () (python-environment-run-block '("python" "--version"))) (pye-deftest pye-test-block-error () (should-error (python-environment-run-block '("python" "-c" "1/0")))) (ert-deftest pye-test-eval-in-subprocess () (pye-eval-in-subprocess '(+ 1 2)) (should-error (pye-eval-in-subprocess '(error "some error")))) (pye-deftest pye-test-bare-make-environment () (let ((tmp-home python-environment-directory)) (pye-eval-in-subprocess '(deferred:sync! (python-environment-make)) `(("HOME" ,tmp-home))) (should (file-directory-p (expand-file-name ".emacs.d/.python-environments/default" tmp-home))))) (provide 'test-python-environment) ;; Local Variables: ;; coding: utf-8 ;; indent-tabs-mode: nil ;; End: ;;; test-python-environment.el ends here emacs-python-environment-0.0.2/python-environment.el0000644000175000017500000002205312477530362022534 0ustar dogslegdogsleg;;; python-environment.el --- virtualenv API for Emacs Lisp ;; Copyright (C) 2015 Takafumi Arakaki ;; Author: Takafumi Arakaki ;; Keywords: applications, tools ;; Version: 0.0.2 ;; Package-Requires: ((deferred "0.3.1")) ;; This file is NOT part of GNU Emacs. ;; python-environment.el is free software: you can redistribute it ;; and/or modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation, either version 3 of ;; the License, or (at your option) any later version. ;; python-environment.el is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with python-environment.el. ;; If not, see . ;;; Commentary: ;; ;;; Code: (require 'deferred) (defconst python-environment-version "0.0.2alpha0") (defcustom python-environment-directory (locate-user-emacs-file ".python-environments") "Path to directory to store all Python virtual environments. A string. If you want to change the location to, say ``~/.python-environments``, then set it like this in your Emacs setup file:: (setq python-environment-directory \"~/.python-environments\")" :group 'python-environment) (defcustom python-environment-default-root-name "default" "Default Python virtual environment name. A string. This is a name of directory relative to `python-environment-directory' where default virtual environment locates. Thus, typically the default virtual environment path is ``~/.emacs.d/.python-environments/default``." :group 'python-environment) (defcustom python-environment-virtualenv (list "virtualenv" "--system-site-packages" "--quiet") ;; --quiet is required for Windows. Without it, virtualenv raises ;; UnicodeEncodeError ;; See: https://github.com/tkf/emacs-jedi/issues/148#issuecomment-38290546 "``virtualenv`` command to use, including command options. List of strings. For example, if you want to use specific Python executable (to specify Python version), append ``--python`` option like this:: (setq python-environment-virtualenv (append python-environment-virtualenv '(\"--python\" \"PATH/TO/bin/python\"))) I added ``--system-site-packages`` as default, but this is not mandatory. If you don't like it, removing does not break anything (well, theoretically). For reason why it is default, see discussion here: https://github.com/tkf/emacs-python-environment/issues/3" :group 'python-environment) (defvar python-environment--verbose nil) (defun python-environment--deferred-process (msg command) (message "%s..." msg) (deferred:$ (apply #'deferred:process command) (deferred:watch it (apply-partially (lambda (msg output) (message "%s...Done" msg) (when python-environment--verbose (message output))) msg)))) (defun python-environment--blocking-process (msg command) (message "%s (SYNC)..." msg) (let (exit-code output) (with-temp-buffer (setq exit-code (apply #'call-process (car command) nil ; INFILE (no input) t ; BUFFER (output to this buffer) nil ; DISPLAY (no refresh is needed) (cdr command))) (setq output (buffer-string))) (when (or python-environment--verbose (not (= exit-code 0))) (message output)) (message "%s (SYNC)...Done" msg) (unless (= exit-code 0) (error "Command %S exits with error code %S." command exit-code)))) (defun python-environment-root-path (&optional root) (expand-file-name (or root python-environment-default-root-name) python-environment-directory)) (defun python-environment--make-with-runner (proc-runner root virtualenv) (let ((path (convert-standard-filename (python-environment-root-path root))) (virtualenv (append (or virtualenv python-environment-virtualenv) (when python-environment--verbose (list "--verbose"))))) (unless (executable-find (car virtualenv)) (error "Program named %S does not exist." (car virtualenv))) (funcall proc-runner (format "Making virtualenv at %s" path) (append virtualenv (list path))))) (defun python-environment-make (&optional root virtualenv) "Make virtual environment at ROOT asynchronously. This function does not wait until ``virtualenv`` finishes. Instead, it returns a deferred object [#]_. So, if you want to do some operation after the ``virtualenv`` command finishes, do something like this:: (deferred:$ (python-environment-make) (deferred:nextc it (lambda (output) DO-SOMETHING-HERE))) If ROOT is specified, it is used instead of `python-environment-default-root-name'. ROOT can be a relative path from `python-environment-virtualenv' or an absolute path. If VIRTUALENV (list of string) is specified, it is used instead of `python-environment-virtualenv'. .. [#] https://github.com/kiwanami/emacs-deferred" (python-environment--make-with-runner #'python-environment--deferred-process root virtualenv)) (defun python-environment-make-block (&optional root virtualenv) "Blocking version of `python-environment-make'. I recommend NOT to use this function in interactive commands. For reason, see `python-environment-run-block'" (python-environment--make-with-runner #'python-environment--blocking-process root virtualenv)) (defun python-environment-exists-p (&optional root) "Return non-`nil' if virtualenv at ROOT exists. See `python-environment-make' for how ROOT is interpreted." (let ((bin (python-environment-bin "python" root))) (and bin (file-exists-p bin)))) (defun python-environment--existing (root &rest paths) (when paths (let ((full-path (expand-file-name (car paths) (python-environment-root-path root)))) (if (file-exists-p full-path) full-path (apply #'python-environment--existing root (cdr paths)))))) (defun python-environment-bin (path &optional root) "Return full path to \"ROOT/bin/PATH\" or \"ROOT/Scripts/PATH\" if exists. ``Scripts`` is used instead of ``bin`` in typical Windows case. In Windows, path with extension \".ext\" may be returned. See `python-environment-make' for how ROOT is interpreted." (python-environment--existing root (concat "bin/" path) (concat "Scripts/" path) (concat "Scripts/" path ".exe"))) (defun python-environment-lib (path &optional root) "Return full path to \"ROOT/lib/PATH\" or \"ROOT/Lib/PATH\" if exists. ``Lib`` is used instead of ``lib`` in typical Windows case. See `python-environment-make' for how ROOT is interpreted." (python-environment--existing root (concat "lib/" path) (concat "Lib/" path))) (defun python-environment--run-with-runner (proc-runner command root) (funcall proc-runner (format "Running: %s" (mapconcat 'identity command " ")) (cons (python-environment-bin (car command) root) (cdr command)))) (defun python-environment--run-1 (&optional command root) (python-environment--run-with-runner #'python-environment--deferred-process command root)) (defun python-environment--run-block-1 (command root) (python-environment--run-with-runner #'python-environment--blocking-process command root)) (defun python-environment-run (command &optional root virtualenv) "Run COMMAND installed in Python virtualenv located at ROOT asynchronously. Instead of waiting for COMMAND to finish, a deferred object [#]_ is returned so that you can chain operations. See `python-environment-make' for how ROOT and VIRTUALENV are interpreted and how to work with deferred object. Use `python-environment-run-block' if you want to wait until the command exit (NOT recommended in interactive command). .. [#] https://github.com/kiwanami/emacs-deferred" (if (python-environment-exists-p root) (python-environment--run-1 command root) (deferred:$ (python-environment-make root virtualenv) (deferred:nextc it (apply-partially (lambda (command root _) (python-environment--run-1 command root)) command root))))) (defun python-environment-run-block (command &optional root virtualenv) "Blocking version of `python-environment-run'. I recommend NOT to use this function in interactive commands. Emacs users have more important things to than waiting for some command to finish." (unless (python-environment-exists-p root) (python-environment-make-block root virtualenv)) (python-environment--run-block-1 command root)) (provide 'python-environment) ;; Local Variables: ;; coding: utf-8 ;; indent-tabs-mode: nil ;; End: ;;; python-environment.el ends here emacs-python-environment-0.0.2/Makefile0000644000175000017500000000125012477530362017763 0ustar dogslegdogslegCASK ?= cask export EMACS ?= emacs EMACS_TEST = ${CASK} exec ${EMACS} -Q \ --directory . --load test-python-environment.el ELPA_DIR = \ .cask/$(shell ${EMACS} -Q --batch --eval '(princ emacs-version)')/elpa # See: cask-elpa-dir .PHONY: test deps _check-deps-readability clean purge travis-ci test: deps ${EMACS_TEST} --batch -f ert-run-tests-batch-and-exit itest: deps ${EMACS_TEST} --eval "(ert t)" deps: ${ELPA_DIR} ${ELPA_DIR}: Cask ${CASK} install test -d $@ ${MAKE} _check-deps-readability touch $@ _check-deps-readability: ${EMACS_TEST} --batch clean: rm -f *.elc purge: clean rm -rf ${ELPA_DIR} travis-ci: test test ! -d ~/.emacs.d/.python-environments emacs-python-environment-0.0.2/Cask0000644000175000017500000000016712477530362017135 0ustar dogslegdogsleg(source "marmalade" "http://marmalade-repo.org/packages/") (development (depends-on "deferred") (depends-on "ert")) emacs-python-environment-0.0.2/.gitignore0000644000175000017500000000002712477530362020314 0ustar dogslegdogsleg.cask doc/build/ *.elc emacs-python-environment-0.0.2/.travis.yml0000644000175000017500000000150012477530362020432 0ustar dogslegdogsleglanguage: emacs-lisp env: matrix: - EMACS=emacs24 - EMACS=emacs-snapshot global: - CASK=$HOME/.cask/bin/cask before_install: # Install virtualenv - sudo apt-get install -qq python-virtualenv - sudo add-apt-repository -y ppa:cassou/emacs - sudo add-apt-repository -y ppa:ubuntu-elisp/ppa - sudo apt-get update -qq - sudo apt-get install -qq $EMACS - if [ "$EMACS" = 'emacs-snapshot' ]; then sudo apt-get install -qq emacs-snapshot-el emacs-snapshot-nox; fi # Install Cask - curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 https://raw.github.com/cask/cask/master/go | python # The following command does (should) not have any effect on test, # but to separate installation phase and testing phase: - make deps script: - make travis-ci