Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add package_metadata from tony/cookiecutter-pypackage. Update setup.p…

…y and doc/conf.py
  • Loading branch information...
commit f1cd36470d08b3ba0ea73fe5b940a8bf5a4db352 1 parent 3ba4809
@tony authored
View
6 CHANGES
@@ -4,12 +4,13 @@ Changelog
Here you can find the recent changes to tmuxp.
-current
--------
+0.1.5-dev
+---------
- [docs] section heading normalization.
- [docs] tao of tmux section now treated as a chatper. tao of tmux may be
split off into its own project.
+- [internals] use conventions from `tony/cookiecutter-pypackage`_
0.1.4
-----
@@ -577,5 +578,6 @@ current
.. _pep257: http://www.python.org/dev/peps/pep-0257/
.. _pep8: http://www.python.org/dev/peps/pep-0008/
.. _pep440: http://www.python.org/dev/peps/pep-0440/
+.. _tony/cookiecutter-pypackage: https://github.com/tony/cookiecutter-pypackage.
.. todo:: # vim: set filetype=rst:
View
6 doc/about.rst
@@ -29,7 +29,7 @@ Differences from tmuxinator / teamocil
please free to `edit this page`_ on github.
Similarities
-""""""""""""
+~~~~~~~~~~~~
**Load sessions** Loads tmux sessions from config
@@ -39,7 +39,7 @@ Similarities
simplified markup for panes that have one command.
Missing
-"""""""
+~~~~~~~
**Stability** tmuxinator and teamocil are far more stable and
well-developed than tmuxp.
@@ -50,7 +50,7 @@ well-developed than tmuxp.
tmuxinator may have support for earlier versions.
Differences
-"""""""""""
+~~~~~~~~~~~
**Programming Language** python. teamocil and tmuxinator uses ruby.
View
38 doc/conf.py
@@ -16,8 +16,15 @@
from tmuxp import __version__
-sys.path.append(os.path.abspath('.'))
-sys.path.append(os.path.abspath('_themes'))
+# Get the project root dir, which is the parent dir of this
+cwd = os.getcwd()
+project_root = os.path.dirname(cwd)
+
+# Insert the project root dir as the first element in the PYTHONPATH.
+# This lets us ensure that the source package is imported, and that its
+# version is used.
+sys.path.insert(0, project_root)
+from ..package_metadata import p
# 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
@@ -52,8 +59,8 @@
master_doc = 'index'
# General information about the project.
-project = u'tmuxp'
-copyright = u'2013, Tony Narlock'
+project = p.title
+copyright = p.copyright
rst_prolog = """
.. note::
@@ -70,9 +77,9 @@
# built documents.
#
# The short X.Y version.
-version = __version__
+version = '%s' % ('.'.join(p.version.split('.'))[:2])
# The full version, including alpha/beta/rc tags.
-release = __version__
+release = '%s' % (p.version)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -196,8 +203,7 @@
#html_file_suffix = None
# Output file base name for HTML help builder.
-htmlhelp_basename = 'tmuxpdoc'
-
+htmlhelp_basename = '%sdoc' % p.title
# -- Options for LaTeX output --------------------------------------------------
@@ -215,8 +221,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'tmuxp.tex', u'tmuxp Documentation',
- u'Tony Narlock', 'manual'),
+ ('index', '{0}.tex'.format(p.package_name), '{0} Documentation'.format(p.title),
+ p.author, 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -245,8 +251,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'tmuxp', u'tmuxp Documentation',
- [u'Tony Narlock'], 1)
+ ('index', p.package_name, '{0} Documentation'.format(p.title),
+ p.author, 1),
]
# If true, show URL addresses after external links.
@@ -259,9 +265,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'tmuxp', u'tmuxp Documentation',
- u'Tony Narlock', 'tmuxp', 'tmuxp',
- 'Miscellaneous'),
+ ('index', '{0}'.format(p.package_name), '{0} Documentation'.format(p.title),
+ p.author, p.package_name, p.description, 'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
@@ -273,6 +278,8 @@
# 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}
@@ -284,5 +291,4 @@
scale=.75,
aspect=0.5,
proportional=True,
- #linewidth=.5,
)
View
61 package_metadata.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import, division, print_function, \
+ with_statement, unicode_literals
+
+import os
+import sys
+import re
+
+package_file = os.path.join(os.path.dirname(__file__), "tmuxp/__init__.py")
+file_content = open(package_file, "rt").read()
+
+
+class Package_Metadata(dict):
+ __getattr__ = dict.__getitem__
+ __setattr__ = dict.__setitem__
+
+ attributes = [
+ 'title', 'package_name', 'author', 'description', 'email',
+ 'version', 'license', 'copyright'
+ ]
+
+ @staticmethod
+ def get_attribute(attr, file_content):
+ regex_expression = r"^__{0}__ = ['\"]([^'\"]*)['\"]".format(attr)
+ mo = re.search(regex_expression, file_content, re.M)
+ if mo:
+ return mo.group(1)
+ else:
+ raise RuntimeError("Unable to find version string in %s." % (package_file,))
+
+ def refresh(self, attributes):
+
+ file_content = open(self.package_file, "rt").read()
+
+ for k in attributes:
+ attr_val = self.get_attribute(k, file_content)
+ if attr_val:
+ self[k] = attr_val
+
+ def __init__(self, package_file, attributes=None):
+
+ if attributes:
+ self.attributes = attributes
+
+ self.package_file = package_file
+
+ self.refresh(self.attributes)
+
+
+p = Package_Metadata(package_file)
+
+
+def print_metadata():
+ for k, v in p.items():
+ print('%s: %s' % (k, v))
+
+if __name__ == '__main__':
+ print_metadata()
+ sys.exit()
View
34 setup.py
@@ -6,9 +6,15 @@
Manage tmux workspaces from JSON and YAML, pythonic API, shell completion.
"""
+import os
import sys
+
from setuptools import setup
+sys.path.insert(0, os.getcwd()) # we want to grab this:
+from package_metadata import p
+
+
with open('requirements.pip') as f:
install_reqs = [line for line in f.read().split('\n') if line]
tests_reqs = []
@@ -17,28 +23,19 @@
install_reqs += ['argparse']
tests_reqs += ['unittest2']
-import re
-VERSIONFILE = "tmuxp/__init__.py"
-verstrline = open(VERSIONFILE, "rt").read()
-VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
-mo = re.search(VSRE, verstrline, re.M)
-if mo:
- __version__ = mo.group(1)
-else:
- raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
-
+readme = open('README.rst').read()
+history = open('CHANGES').read().replace('.. :changelog:', '')
setup(
- name='tmuxp',
- version=__version__,
+ name=p.title,
+ version=p.version,
url='http://github.com/tony/tmuxp/',
download_url='https://pypi.python.org/pypi/tmuxp',
- license='BSD',
- author='Tony Narlock',
- author_email='tony@git-pull.com',
- description='Manage tmux workspaces from JSON and YAML, pythonic API, '
- 'shell completion',
- long_description=open('README.rst').read(),
+ license=p.license,
+ author=p.author,
+ author_email=p.email,
+ description=p.description,
+ long_description=readme,
packages=['tmuxp', 'tmuxp.testsuite',
'tmuxp._vendor', 'tmuxp._vendor.colorama'],
include_package_data=True,
@@ -46,6 +43,7 @@
tests_require=tests_reqs,
test_suite='tmuxp.testsuite',
zip_safe=False,
+ keywords=p.title,
scripts=['pkg/tmuxp.bash', 'pkg/tmuxp.zsh', 'pkg/tmuxp.tcsh'],
entry_points=dict(console_scripts=['tmuxp=tmuxp:cli.main']),
classifiers=[
View
3  tmuxp/__init__.py
@@ -12,7 +12,10 @@
with_statement, unicode_literals
__title__ = 'tmuxp'
+__package_name__ = 'tmuxp'
__version__ = '0.1.4'
+__description__ = 'Manage tmux sessions thru JSON, YAML configs. Features Python API'
+__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2013 Tony Narlock'
Please sign in to comment.
Something went wrong with that request. Please try again.