<commit_before># (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import multiprocessing
import os
import socket
import sys
import tempfile

from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.executor.play_iterator import PlayIterator
from ansible.executor.process.worker import WorkerProcess
from ansible.executor.process.result import ResultProcess
from ansible.executor.stats import AggregateStats
from ansible.playbook.play_context import PlayContext
from ansible.plugins import callback_loader, strategy_loader, module_loader
from ansible.template import Templar

__all__ = ['TaskQueueManager']

class TaskQueueManager:

    '''
    This class handles the multiprocessing requirements of Ansible by
    creating a pool of worker forks, a result handler fork, and a
    manager object with shared datastructures/queues for coordinating
    work between all processes.

    The queue manager is responsible for loading the play strategy plugin,
    which dispatches the Play's tasks to hosts.
    '''

    def __init__(self, inventory, variable_manager, loader, display, options, passwords, stdout_callback=None):

        self._inventory        = inventory
        self._variable_manager = variable_manager
        self._loader           = loader
        self._display          = display
        self._options          = options
        self._stats            = AggregateStats()
        self.passwords         = passwords
        self._stdout_callback  = stdout_callback

        self._callbacks_loaded = False
        self._callback_plugins = []
        self._start_at_done    = False

        # make sure the module path (if specified) is parsed and
        # added to the module_loader object
        if options.module_path is not None:
            for path in options.module_path.split(os.pathsep):
                module_loader.add_directory(path)

        # a special flag to help us exit cleanly
        self._terminated = False

        # this dictionary is used to keep track of notified handlers
        self._notified_handlers = dict()

        # dictionaries to keep track of failed/unreachable hosts
        self._failed_hosts      = dict()
        self._unreachable_hosts = dict()

        self._final_q = multiprocessing.Queue()

        # create the pool of worker threads, based on the number of forks specified
        try:
            fileno = sys.stdin.fileno()
        except ValueError:
            fileno = None

        # A temporary file (opened pre-fork) used by connection
        # plugins for inter-process locking.
        self._connection_lockfile = tempfile.TemporaryFile()

        # Treat "forks" config parameter as max value. Only create number of workers
        # equal to number of hosts in inventory if less than max value.
        num_workers = self._options.forks
        if self._options.forks > len(self._inventory.list_hosts()):
            num_workers = len(self._inventory.list_hosts())

        self._workers = []
        for i in range(num_workers):
            main_q = multiprocessing.Queue()
            rslt_q = multiprocessing.Queue()

            prc = WorkerProcess(self, main_q, rslt_q, loader)
            prc.start()

            self._workers.append((prc, main_q, rslt_q))

        self._result_prc = ResultProcess(self._final_q, self._workers)
        self._result_prc.start()

    def _initialize_notified_handlers(self, handlers):
        '''
        Clears and initializes the shared notified handlers dict with entries
        for each handler in the play, which is an empty array that will contain
        inventory hostnames for those hosts triggering the handler.
        '''

        # Zero the dictionary first by removing any entries there.
        # Proxied dicts don't support iteritems, so we have to use keys()
        for key in self._notified_handlers.keys():
            del self._notified_handlers[key]

        # FIXME: there is a block compile helper for this...
        handler_list = []
        for handler_block in handlers:
            for handler in handler_block.block:
                handler_list.append(handler)

        # then initialize it with the handler names from the handler list
        for handler in handler_list:
            self._notified_handlers[handler.get_name()] = []

    def load_callbacks(self):
        '''
        Loads all available callbacks, with the exception of those which
        utilize the CALLBACK_TYPE option. When CALLBACK_TYPE is set to 'stdout',
        only one such callback plugin will be loaded.
        '''

        if self._callbacks_loaded:
            return

        stdout_callback_loaded = False
        if self._stdout_callback is None:
            self._stdout_callback = C.DEFAULT_STDOUT_CALLBACK

        if self._stdout_callback not in callback_loader:
            raise AnsibleError("Invalid callback for stdout specified: %s" % self._stdout_callback)

        for callback_plugin in callback_loader.all(class_only=True):
            if hasattr(callback_plugin, 'CALLBACK_VERSION') and callback_plugin.CALLBACK_VERSION >= 2.0:
                # we only allow one callback of type 'stdout' to be loaded, so check
                # the name of the current plugin and type to see if we need to skip
                # loading this callback plugin
                callback_type = getattr(callback_plugin, 'CALLBACK_TYPE', None)
                (callback_name, _) = os.path.splitext(os.path.basename(callback_plugin._original_path))
                if callback_type == 'stdout':
                    if callback_name != self._stdout_callback or stdout_callback_loaded:
                        continue
                    stdout_callback_loaded = True
                elif C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST:
                    continue

                self._callback_plugins.append(callback_plugin(self._display))
            else:
                self._callback_plugins.append(callback_plugin())

        self._callbacks_loaded = True

    def run(self, play):
        '''
        Iterates over the roles/tasks in a play, using the given (or default)
        strategy for queueing tasks. The default is the linear strategy, which
        operates like classic Ansible by keeping all hosts in lock-step with
        a given task (meaning no hosts move on to the next task until all hosts
        are done with the current task).
        '''

        if not self._callbacks_loaded:
            self.load_callbacks()

        all_vars = self._variable_manager.get_vars(loader=self._loader, play=play)
        templar = Templar(loader=self._loader, variables=all_vars)

        new_play = play.copy()
        new_play.post_validate(templar)

        play_context = PlayContext(new_play, self._options, self.passwords, self._connection_lockfile.fileno())
        for callback_plugin in self._callback_plugins:
            if hasattr(callback_plugin, 'set_play_context'):
                callback_plugin.set_play_context(play_context)

        self.send_callback('v2_playbook_on_play_start', new_play)

        # initialize the shared dictionary containing the notified handlers
        self._initialize_notified_handlers(new_play.handlers)

        # load the specified strategy (or the default linear one)
        strategy = strategy_loader.get(new_play.strategy, self)
        if strategy is None:
            raise AnsibleError("Invalid play strategy specified: %s" % new_play.strategy, obj=play._ds)

        # build the iterator
        iterator = PlayIterator(
            inventory=self._inventory,
            play=new_play,
            play_context=play_context,
            variable_manager=self._variable_manager,
            all_vars=all_vars,
            start_at_done = self._start_at_done,
        )

        # during initialization, the PlayContext will clear the start_at_task
        # field to signal that a matching task was found, so check that here
        # and remember it so we don't try to skip tasks on future plays
        if getattr(self._options, 'start_at_task', None) is not None and play_context.start_at_task is None:
            self._start_at_done = True

        # and run the play using the strategy
        return strategy.run(iterator, play_context)

    def cleanup(self):
        self._display.debug("RUNNING CLEANUP")

        self.terminate()

        self._final_q.close()
        self._result_prc.terminate()

        for (worker_prc, main_q, rslt_q) in self._workers:
            rslt_q.close()
            main_q.close()
            worker_prc.terminate()

    def clear_failed_hosts(self):
        self._failed_hosts = dict()

    def get_inventory(self):
        return self._inventory

    def get_variable_manager(self):
        return self._variable_manager

    def get_loader(self):
        return self._loader

    def get_notified_handlers(self):
        return self._notified_handlers

    def get_workers(self):
        return self._workers[:]

    def terminate(self):
        self._terminated = True

    def send_callback(self, method_name, *args, **kwargs):
        for callback_plugin in self._callback_plugins:
            # a plugin that set self.disabled to True will not be called
            # see osx_say.py example for such a plugin
            if getattr(callback_plugin, 'disabled', False):
                continue
            methods = [
                getattr(callback_plugin, method_name, None),
                getattr(callback_plugin, 'v2_on_any', None)
            ]
            for method in methods:
                if method is not None:
                    try:
                        method(*args, **kwargs)
                    except Exception as e:
                        self._display.warning('Error when using %s: %s' % (method, str(e)))
<commit_msg>better limiting of forks to lowest actual restriction<commit_after># (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import multiprocessing
import os
import socket
import sys
import tempfile

from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.executor.play_iterator import PlayIterator
from ansible.executor.process.worker import WorkerProcess
from ansible.executor.process.result import ResultProcess
from ansible.executor.stats import AggregateStats
from ansible.playbook.play_context import PlayContext
from ansible.plugins import callback_loader, strategy_loader, module_loader
from ansible.template import Templar

__all__ = ['TaskQueueManager']

class TaskQueueManager:

    '''
    This class handles the multiprocessing requirements of Ansible by
    creating a pool of worker forks, a result handler fork, and a
    manager object with shared datastructures/queues for coordinating
    work between all processes.

    The queue manager is responsible for loading the play strategy plugin,
    which dispatches the Play's tasks to hosts.
    '''

    def __init__(self, inventory, variable_manager, loader, display, options, passwords, stdout_callback=None):

        self._inventory        = inventory
        self._variable_manager = variable_manager
        self._loader           = loader
        self._display          = display
        self._options          = options
        self._stats            = AggregateStats()
        self.passwords         = passwords
        self._stdout_callback  = stdout_callback

        self._callbacks_loaded = False
        self._callback_plugins = []
        self._start_at_done    = False

        # make sure the module path (if specified) is parsed and
        # added to the module_loader object
        if options.module_path is not None:
            for path in options.module_path.split(os.pathsep):
                module_loader.add_directory(path)

        # a special flag to help us exit cleanly
        self._terminated = False

        # this dictionary is used to keep track of notified handlers
        self._notified_handlers = dict()

        # dictionaries to keep track of failed/unreachable hosts
        self._failed_hosts      = dict()
        self._unreachable_hosts = dict()

        self._final_q = multiprocessing.Queue()

        # create the pool of worker threads, based on the number of forks specified
        try:
            fileno = sys.stdin.fileno()
        except ValueError:
            fileno = None

        # A temporary file (opened pre-fork) used by connection
        # plugins for inter-process locking.
        self._connection_lockfile = tempfile.TemporaryFile()

        # Treat "forks" config parameter as max value. Only create number of workers
        # equal to number of hosts in inventory if less than max value or serial batch.
        num_workers = min(self._options.forks, self._options.serial, len(self._inventory.list_hosts()))

        self._workers = []
        for i in range(num_workers):
            main_q = multiprocessing.Queue()
            rslt_q = multiprocessing.Queue()

            prc = WorkerProcess(self, main_q, rslt_q, loader)
            prc.start()

            self._workers.append((prc, main_q, rslt_q))

        self._result_prc = ResultProcess(self._final_q, self._workers)
        self._result_prc.start()

    def _initialize_notified_handlers(self, handlers):
        '''
        Clears and initializes the shared notified handlers dict with entries
        for each handler in the play, which is an empty array that will contain
        inventory hostnames for those hosts triggering the handler.
        '''

        # Zero the dictionary first by removing any entries there.
        # Proxied dicts don't support iteritems, so we have to use keys()
        for key in self._notified_handlers.keys():
            del self._notified_handlers[key]

        # FIXME: there is a block compile helper for this...
        handler_list = []
        for handler_block in handlers:
            for handler in handler_block.block:
                handler_list.append(handler)

        # then initialize it with the handler names from the handler list
        for handler in handler_list:
            self._notified_handlers[handler.get_name()] = []

    def load_callbacks(self):
        '''
        Loads all available callbacks, with the exception of those which
        utilize the CALLBACK_TYPE option. When CALLBACK_TYPE is set to 'stdout',
        only one such callback plugin will be loaded.
        '''

        if self._callbacks_loaded:
            return

        stdout_callback_loaded = False
        if self._stdout_callback is None:
            self._stdout_callback = C.DEFAULT_STDOUT_CALLBACK

        if self._stdout_callback not in callback_loader:
            raise AnsibleError("Invalid callback for stdout specified: %s" % self._stdout_callback)

        for callback_plugin in callback_loader.all(class_only=True):
            if hasattr(callback_plugin, 'CALLBACK_VERSION') and callback_plugin.CALLBACK_VERSION >= 2.0:
                # we only allow one callback of type 'stdout' to be loaded, so check
                # the name of the current plugin and type to see if we need to skip
                # loading this callback plugin
                callback_type = getattr(callback_plugin, 'CALLBACK_TYPE', None)
                (callback_name, _) = os.path.splitext(os.path.basename(callback_plugin._original_path))
                if callback_type == 'stdout':
                    if callback_name != self._stdout_callback or stdout_callback_loaded:
                        continue
                    stdout_callback_loaded = True
                elif C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST:
                    continue

                self._callback_plugins.append(callback_plugin(self._display))
            else:
                self._callback_plugins.append(callback_plugin())

        self._callbacks_loaded = True

    def run(self, play):
        '''
        Iterates over the roles/tasks in a play, using the given (or default)
        strategy for queueing tasks. The default is the linear strategy, which
        operates like classic Ansible by keeping all hosts in lock-step with
        a given task (meaning no hosts move on to the next task until all hosts
        are done with the current task).
        '''

        if not self._callbacks_loaded:
            self.load_callbacks()

        all_vars = self._variable_manager.get_vars(loader=self._loader, play=play)
        templar = Templar(loader=self._loader, variables=all_vars)

        new_play = play.copy()
        new_play.post_validate(templar)

        play_context = PlayContext(new_play, self._options, self.passwords, self._connection_lockfile.fileno())
        for callback_plugin in self._callback_plugins:
            if hasattr(callback_plugin, 'set_play_context'):
                callback_plugin.set_play_context(play_context)

        self.send_callback('v2_playbook_on_play_start', new_play)

        # initialize the shared dictionary containing the notified handlers
        self._initialize_notified_handlers(new_play.handlers)

        # load the specified strategy (or the default linear one)
        strategy = strategy_loader.get(new_play.strategy, self)
        if strategy is None:
            raise AnsibleError("Invalid play strategy specified: %s" % new_play.strategy, obj=play._ds)

        # build the iterator
        iterator = PlayIterator(
            inventory=self._inventory,
            play=new_play,
            play_context=play_context,
            variable_manager=self._variable_manager,
            all_vars=all_vars,
            start_at_done = self._start_at_done,
        )

        # during initialization, the PlayContext will clear the start_at_task
        # field to signal that a matching task was found, so check that here
        # and remember it so we don't try to skip tasks on future plays
        if getattr(self._options, 'start_at_task', None) is not None and play_context.start_at_task is None:
            self._start_at_done = True

        # and run the play using the strategy
        return strategy.run(iterator, play_context)

    def cleanup(self):
        self._display.debug("RUNNING CLEANUP")

        self.terminate()

        self._final_q.close()
        self._result_prc.terminate()

        for (worker_prc, main_q, rslt_q) in self._workers:
            rslt_q.close()
            main_q.close()
            worker_prc.terminate()

    def clear_failed_hosts(self):
        self._failed_hosts = dict()

    def get_inventory(self):
        return self._inventory

    def get_variable_manager(self):
        return self._variable_manager

    def get_loader(self):
        return self._loader

    def get_notified_handlers(self):
        return self._notified_handlers

    def get_workers(self):
        return self._workers[:]

    def terminate(self):
        self._terminated = True

    def send_callback(self, method_name, *args, **kwargs):
        for callback_plugin in self._callback_plugins:
            # a plugin that set self.disabled to True will not be called
            # see osx_say.py example for such a plugin
            if getattr(callback_plugin, 'disabled', False):
                continue
            methods = [
                getattr(callback_plugin, method_name, None),
                getattr(callback_plugin, 'v2_on_any', None)
            ]
            for method in methods:
                if method is not None:
                    try:
                        method(*args, **kwargs)
                    except Exception as e:
                        self._display.warning('Error when using %s: %s' % (method, str(e)))
<|endoftext|>


<commit_before>"""
JSON Config Parser
==================

A straightforward and unambiguous config file parser.
Parses ini style files with json keys.
"""
from setuptools import setup

setup(
    name='json-config-parser',
    version='0.1.0',
    author='Ben Mather',
    author_email='bwhmather@bwhmather.com',
    description='A straightforward and unambiguous config file parser.',
    long_description=__doc__,
    url='https://github.com/bwhmather/json-config-parser/',
    license='BSD',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Python Software Foundation License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'License :: OSI Approved :: BSD License',
        ],
    platforms='any',
    py_packages=['jsonconfigparser', 'jsonconfigparser.tests'],
    test_suite='jsonconfigparser.tests.suite',
    )
<commit_msg>bump version to 0.1.1<commit_after>"""
JSON Config Parser
==================

A straightforward and unambiguous config file parser.
Parses ini style files with json keys.
"""
from setuptools import setup

setup(
    name='json-config-parser',
    version='0.1.1',
    author='Ben Mather',
    author_email='bwhmather@bwhmather.com',
    description='A straightforward and unambiguous config file parser.',
    long_description=__doc__,
    url='https://github.com/bwhmather/json-config-parser/',
    license='BSD',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Python Software Foundation License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3',
        'Topic :: Software Development :: Libraries',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'License :: OSI Approved :: BSD License',
        ],
    platforms='any',
    py_packages=['jsonconfigparser', 'jsonconfigparser.tests'],
    test_suite='jsonconfigparser.tests.suite',
    )
<|endoftext|>


<commit_before>#!/usr/bin/python
# Copyright 2013 Google Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
module: gce_pd
version_added: "1.4"
short_description: utilize GCE persistent disk resources
description:
    - This module can create and destroy unformatted GCE persistent disks
      U(https://developers.google.com/compute/docs/disks#persistentdisks).
      It also supports attaching and detaching disks from running instances.
      Full install/configuration instructions for the gce* modules can
      be found in the comments of ansible/test/gce_tests.py.
options:
  detach_only:
    description:
      - do not destroy the disk, merely detach it from an instance
    required: false
    default: "no"
    choices: ["yes", "no"]
    aliases: []
  instance_name:
    description:
      - instance name if you wish to attach or detach the disk
    required: false
    default: null
    aliases: []
  mode:
    description:
      - GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
    required: false
    default: "READ_ONLY"
    choices: ["READ_WRITE", "READ_ONLY"]
    aliases: []
  name:
    description:
      - name of the disk
    required: true
    default: null
    aliases: []
  size_gb:
    description:
      - whole integer size of disk (in GB) to create, default is 10 GB
    required: false
    default: 10
    aliases: []
  image:
    description:
      - the source image to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  snapshot:
    description:
      - the source snapshot to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  state:
    description:
      - desired state of the persistent disk
    required: false
    default: "present"
    choices: ["active", "present", "absent", "deleted"]
    aliases: []
  zone:
    description:
      - zone in which to create the disk
    required: false
    default: "us-central1-b"
    aliases: []
  service_account_email:
    version_added: "1.6"
    description:
      - service account email
    required: false
    default: null
    aliases: []
  pem_file:
    version_added: "1.6"
    description:
      - path to the pem file associated with the service account email
    required: false
    default: null
    aliases: []
  project_id:
    version_added: "1.6"
    description:
      - your GCE project ID
    required: false
    default: null
    aliases: []

requirements: [ "libcloud" ]
author: Eric Johnson <erjohnso@google.com>
'''

EXAMPLES = '''
# Simple attachment action to an existing instance
- local_action:
    module: gce_pd
    instance_name: notlocalhost
    size_gb: 5
    name: pd
'''

import sys

try:
    from libcloud.compute.types import Provider
    from libcloud.compute.providers import get_driver
    from libcloud.common.google import GoogleBaseError, QuotaExceededError, \
            ResourceExistsError, ResourceNotFoundError, ResourceInUseError
    _ = Provider.GCE
except ImportError:
    print("failed=True " + \
        "msg='libcloud with GCE support is required for this module.'")
    sys.exit(1)

def main():
    module = AnsibleModule(
        argument_spec = dict(
            detach_only = dict(type='bool'),
            instance_name = dict(),
            mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']),
            name = dict(required=True),
            size_gb = dict(default=10),
            image = dict(),
            snapshot = dict(),
            state = dict(default='present'),
            zone = dict(default='us-central1-b'),
            service_account_email = dict(),
            pem_file = dict(),
            project_id = dict(),
        )
    )

    gce = gce_connect(module)

    detach_only = module.params.get('detach_only')
    instance_name = module.params.get('instance_name')
    mode = module.params.get('mode')
    name = module.params.get('name')
    size_gb = module.params.get('size_gb')
    image = module.params.get('image')
    snapshot = module.params.get('snapshot')
    state = module.params.get('state')
    zone = module.params.get('zone')

    if detach_only and not instance_name:
        module.fail_json(
            msg='Must specify an instance name when detaching a disk',
            changed=False)

    disk = inst = None
    changed = is_attached = False

    json_output = { 'name': name, 'zone': zone, 'state': state }
    if detach_only:
        json_output['detach_only'] = True
        json_output['detached_from_instance'] = instance_name

    if instance_name:
        # user wants to attach/detach from an existing instance
        try:
            inst = gce.ex_get_node(instance_name, zone)
            # is the disk attached?
            for d in inst.extra['disks']:
                if d['deviceName'] == name:
                    is_attached = True
                    json_output['attached_mode'] = d['mode']
                    json_output['attached_to_instance'] = inst.name
        except:
            pass

    # find disk if it already exists
    try:
        disk = gce.ex_get_volume(name)
        json_output['size_gb'] = int(disk.size)
    except ResourceNotFoundError:
        pass
    except Exception, e:
        module.fail_json(msg=unexpected_error_msg(e), changed=False)

    # user wants a disk to exist.  If "instance_name" is supplied the user
    # also wants it attached
    if state in ['active', 'present']:

        if not size_gb:
            module.fail_json(msg="Must supply a size_gb", changed=False)
        try:
            size_gb = int(round(float(size_gb)))
            if size_gb < 1:
                raise Exception
        except:
            module.fail_json(msg="Must supply a size_gb larger than 1 GB",
                    changed=False)

        if instance_name and inst is None:
            module.fail_json(msg='Instance %s does not exist in zone %s' % (
                    instance_name, zone), changed=False)

        if not disk:
            if image is not None and snapshot is not None:
                module.fail_json(
                    msg='Cannot give both image (%s) and snapshot (%s)' % (
                        image, snapshot), changed=False)
            lc_image = None
            lc_snapshot = None
            if image is not None:
                lc_image = gce.ex_get_image(image)
            elif snapshot is not None:
                lc_snapshot = gce.ex_get_snapshot(snapshot)
            try:
                disk = gce.create_volume(
                    size_gb, name, location=zone, image=lc_image,
                    snapshot=lc_snapshot)
            except ResourceExistsError:
                pass
            except QuotaExceededError:
                module.fail_json(msg='Requested disk size exceeds quota',
                        changed=False)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['size_gb'] = size_gb
            if image is not None:
                json_output['image'] = image
            if snapshot is not None:
                json_output['snapshot'] = snapshot
            changed = True
        if inst and not is_attached:
            try:
                gce.attach_volume(inst, disk, device=name, ex_mode=mode)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['attached_to_instance'] = inst.name
            json_output['attached_mode'] = mode
            changed = True

    # user wants to delete a disk (or perhaps just detach it).
    if state in ['absent', 'deleted'] and disk:

        if inst and is_attached:
            try:
                gce.detach_volume(disk, ex_node=inst)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True
        if not detach_only:
            try:
                gce.destroy_volume(disk)
            except ResourceInUseError, e:
                module.fail_json(msg=str(e.value), changed=False)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True

    json_output['changed'] = changed
    print json.dumps(json_output)
    sys.exit(0)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.gce import *

main()
<commit_msg>adding disk_type option to choose from pd-ssd or pd-standard<commit_after>#!/usr/bin/python
# Copyright 2013 Google Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
module: gce_pd
version_added: "1.4"
short_description: utilize GCE persistent disk resources
description:
    - This module can create and destroy unformatted GCE persistent disks
      U(https://developers.google.com/compute/docs/disks#persistentdisks).
      It also supports attaching and detaching disks from running instances.
      Full install/configuration instructions for the gce* modules can
      be found in the comments of ansible/test/gce_tests.py.
options:
  detach_only:
    description:
      - do not destroy the disk, merely detach it from an instance
    required: false
    default: "no"
    choices: ["yes", "no"]
    aliases: []
  instance_name:
    description:
      - instance name if you wish to attach or detach the disk
    required: false
    default: null
    aliases: []
  mode:
    description:
      - GCE mount mode of disk, READ_ONLY (default) or READ_WRITE
    required: false
    default: "READ_ONLY"
    choices: ["READ_WRITE", "READ_ONLY"]
    aliases: []
  name:
    description:
      - name of the disk
    required: true
    default: null
    aliases: []
  size_gb:
    description:
      - whole integer size of disk (in GB) to create, default is 10 GB
    required: false
    default: 10
    aliases: []
  image:
    description:
      - the source image to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  snapshot:
    description:
      - the source snapshot to use for the disk
    required: false
    default: null
    aliases: []
    version_added: "1.7"
  state:
    description:
      - desired state of the persistent disk
    required: false
    default: "present"
    choices: ["active", "present", "absent", "deleted"]
    aliases: []
  zone:
    description:
      - zone in which to create the disk
    required: false
    default: "us-central1-b"
    aliases: []
  service_account_email:
    version_added: "1.6"
    description:
      - service account email
    required: false
    default: null
    aliases: []
  pem_file:
    version_added: "1.6"
    description:
      - path to the pem file associated with the service account email
    required: false
    default: null
    aliases: []
  project_id:
    version_added: "1.6"
    description:
      - your GCE project ID
    required: false
    default: null
    aliases: []
  disk_type:
    version_added: "1.9"
    description:
      - type of disk provisioned
    required: false
    default: "pd-standard"
    choices: ["pd-standard", "pd-ssd"]
    aliases: []

requirements: [ "libcloud" ]
author: Eric Johnson <erjohnso@google.com>
'''

EXAMPLES = '''
# Simple attachment action to an existing instance
- local_action:
    module: gce_pd
    instance_name: notlocalhost
    size_gb: 5
    name: pd
'''

import sys

try:
    from libcloud.compute.types import Provider
    from libcloud.compute.providers import get_driver
    from libcloud.common.google import GoogleBaseError, QuotaExceededError, \
            ResourceExistsError, ResourceNotFoundError, ResourceInUseError
    _ = Provider.GCE
except ImportError:
    print("failed=True " + \
        "msg='libcloud with GCE support is required for this module.'")
    sys.exit(1)

def main():
    module = AnsibleModule(
        argument_spec = dict(
            detach_only = dict(type='bool'),
            instance_name = dict(),
            mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']),
            name = dict(required=True),
            size_gb = dict(default=10),
            disk_type = dict(default='pd-standard'),
            image = dict(),
            snapshot = dict(),
            state = dict(default='present'),
            zone = dict(default='us-central1-b'),
            service_account_email = dict(),
            pem_file = dict(),
            project_id = dict(),
        )
    )

    gce = gce_connect(module)

    detach_only = module.params.get('detach_only')
    instance_name = module.params.get('instance_name')
    mode = module.params.get('mode')
    name = module.params.get('name')
    size_gb = module.params.get('size_gb')
    disk_type = module.params.get('disk_type')
    image = module.params.get('image')
    snapshot = module.params.get('snapshot')
    state = module.params.get('state')
    zone = module.params.get('zone')

    if detach_only and not instance_name:
        module.fail_json(
            msg='Must specify an instance name when detaching a disk',
            changed=False)

    disk = inst = None
    changed = is_attached = False

    json_output = { 'name': name, 'zone': zone, 'state': state, 'disk_type': disk_type  }
    if detach_only:
        json_output['detach_only'] = True
        json_output['detached_from_instance'] = instance_name

    if instance_name:
        # user wants to attach/detach from an existing instance
        try:
            inst = gce.ex_get_node(instance_name, zone)
            # is the disk attached?
            for d in inst.extra['disks']:
                if d['deviceName'] == name:
                    is_attached = True
                    json_output['attached_mode'] = d['mode']
                    json_output['attached_to_instance'] = inst.name
        except:
            pass

    # find disk if it already exists
    try:
        disk = gce.ex_get_volume(name)
        json_output['size_gb'] = int(disk.size)
    except ResourceNotFoundError:
        pass
    except Exception, e:
        module.fail_json(msg=unexpected_error_msg(e), changed=False)

    # user wants a disk to exist.  If "instance_name" is supplied the user
    # also wants it attached
    if state in ['active', 'present']:

        if not size_gb:
            module.fail_json(msg="Must supply a size_gb", changed=False)
        try:
            size_gb = int(round(float(size_gb)))
            if size_gb < 1:
                raise Exception
        except:
            module.fail_json(msg="Must supply a size_gb larger than 1 GB",
                    changed=False)

        if instance_name and inst is None:
            module.fail_json(msg='Instance %s does not exist in zone %s' % (
                    instance_name, zone), changed=False)

        if not disk:
            if image is not None and snapshot is not None:
                module.fail_json(
                    msg='Cannot give both image (%s) and snapshot (%s)' % (
                        image, snapshot), changed=False)
            lc_image = None
            lc_snapshot = None
            if image is not None:
                lc_image = gce.ex_get_image(image)
            elif snapshot is not None:
                lc_snapshot = gce.ex_get_snapshot(snapshot)
            try:
                disk = gce.create_volume(
                    size_gb, name, location=zone, image=lc_image,
                    snapshot=lc_snapshot, ex_disk_type=disk_type)
            except ResourceExistsError:
                pass
            except QuotaExceededError:
                module.fail_json(msg='Requested disk size exceeds quota',
                        changed=False)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['size_gb'] = size_gb
            if image is not None:
                json_output['image'] = image
            if snapshot is not None:
                json_output['snapshot'] = snapshot
            changed = True
        if inst and not is_attached:
            try:
                gce.attach_volume(inst, disk, device=name, ex_mode=mode)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            json_output['attached_to_instance'] = inst.name
            json_output['attached_mode'] = mode
            changed = True

    # user wants to delete a disk (or perhaps just detach it).
    if state in ['absent', 'deleted'] and disk:

        if inst and is_attached:
            try:
                gce.detach_volume(disk, ex_node=inst)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True
        if not detach_only:
            try:
                gce.destroy_volume(disk)
            except ResourceInUseError, e:
                module.fail_json(msg=str(e.value), changed=False)
            except Exception, e:
                module.fail_json(msg=unexpected_error_msg(e), changed=False)
            changed = True

    json_output['changed'] = changed
    print json.dumps(json_output)
    sys.exit(0)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.gce import *

main()
<|endoftext|>


<commit_before>from setuptools import find_packages
from distutils.core import setup

setup(
    name='skipper',
    version='0.0.1',
    url='http://github.com/Stratoscale/skipper',
    author='Adir Gabai',
    author_mail='adir@stratoscale.com',
    packages=find_packages(include=['skipper*']),
    data_files=[
        ('/etc/bash_completion.d', ['data/skipper-complete.sh']),
    ],
    entry_points={
          'console_scripts': [
              'skipper = skipper.main:main',
          ],
      },
    install_requires=[
            'PyYAML>=3.11',
            'click>=6.6',
            'requests>=2.10.0',
            'tabulate>=0.7.5',
        ]
)
<commit_msg>Install bash completion script only when running the installation script as root. This is also a workaround for a bug that prevents tox from install the above script while creating the virtual environment.<commit_after>import os
from setuptools import find_packages
from distutils.core import setup

data_files = []
# Add bash completion script in case we are running as root
if os.getuid() == 0:
    data_files=[
        ('/etc/bash_completion.d', ['data/skipper-complete.sh'])
    ]

setup(
    name='skipper',
    version='0.0.1',
    url='http://github.com/Stratoscale/skipper',
    author='Adir Gabai',
    author_mail='adir@stratoscale.com',
    packages=find_packages(include=['skipper*']),
    data_files=data_files,
    entry_points={
          'console_scripts': [
              'skipper = skipper.main:main',
          ],
      },
    install_requires=[
            'PyYAML>=3.11',
            'click>=6.6',
            'requests>=2.10.0',
            'tabulate>=0.7.5',
        ]
)
<|endoftext|>


<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2015, Matt Makai <matthew.makai@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

ANSIBLE_METADATA = {'status': ['preview'],
                    'supported_by': 'community',
                    'version': '1.0'}

DOCUMENTATION = '''
---
version_added: "1.6"
module: twilio
short_description: Sends a text message to a mobile phone through Twilio.
description:
   - Sends a text message to a phone number through the Twilio messaging API.
notes:
   - This module is non-idempotent because it sends an email through the
     external API. It is idempotent only in the case that the module fails.
   - Like the other notification modules, this one requires an external
     dependency to work. In this case, you'll need a Twilio account with
     a purchased or verified phone number to send the text message.
options:
  account_sid:
    description:
      user's Twilio account token found on the account page
    required: true
  auth_token:
    description: user's Twilio authentication token
    required: true
  msg:
    description:
      the body of the text message
    required: true
  to_number:
    description:
      one or more phone numbers to send the text message to,
      format +15551112222
    required: true
  from_number:
    description:
      the Twilio number to send the text message from, format +15551112222
    required: true
  media_url:
    description:
      a URL with a picture, video or sound clip to send with an MMS
      (multimedia message) instead of a plain SMS
    required: false

author: "Matt Makai (@makaimc)"
'''

EXAMPLES = '''
# send an SMS about the build status to (555) 303 5681
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: "All servers with webserver role are now configured."
    account_sid: "ACXXXXXXXXXXXXXXXXX"
    auth_token: "ACXXXXXXXXXXXXXXXXX"
    from_number: "+15552014545"
    to_number: "+15553035681"
  delegate_to: localhost

# send an SMS to multiple phone numbers about the deployment
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: "This server's configuration is now complete."
    account_sid: "ACXXXXXXXXXXXXXXXXX"
    auth_token: "ACXXXXXXXXXXXXXXXXX"
    from_number: "+15553258899"
    to_number:
      - "+15551113232"
      - "+12025551235"
      - "+19735559010"
  delegate_to: localhost

# send an MMS to a single recipient with an update on the deployment
# and an image of the results
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: "Deployment complete!"
    account_sid: "ACXXXXXXXXXXXXXXXXX"
    auth_token: "ACXXXXXXXXXXXXXXXXX"
    from_number: "+15552014545"
    to_number: "+15553035681"
    media_url: "https://demo.twilio.com/logo.png"
  delegate_to: localhost
'''

# =======================================
# twilio module support methods
#
import urllib

def post_twilio_api(module, account_sid, auth_token, msg, from_number,
                    to_number, media_url=None):
    URI = "https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json" \
        % (account_sid,)
    AGENT = "Ansible"

    data = {'From':from_number, 'To':to_number, 'Body':msg}
    if media_url:
        data['MediaUrl'] = media_url
    encoded_data = urllib.urlencode(data)

    headers = {'User-Agent': AGENT,
            'Content-type': 'application/x-www-form-urlencoded',
            'Accept': 'application/json',
            }

    # Hack module params to have the Basic auth params that fetch_url expects
    module.params['url_username'] = account_sid.replace('\n', '')
    module.params['url_password'] = auth_token.replace('\n', '')

    return fetch_url(module, URI, data=encoded_data, headers=headers)

# =======================================
# Main
#

def main():

    module = AnsibleModule(
        argument_spec=dict(
            account_sid=dict(required=True),
            auth_token=dict(required=True, no_log=True),
            msg=dict(required=True),
            from_number=dict(required=True),
            to_number=dict(required=True),
            media_url=dict(default=None, required=False),
        ),
        supports_check_mode=True
    )

    account_sid = module.params['account_sid']
    auth_token = module.params['auth_token']
    msg = module.params['msg']
    from_number = module.params['from_number']
    to_number = module.params['to_number']
    media_url = module.params['media_url']

    if not isinstance(to_number, list):
        to_number = [to_number]

    for number in to_number:
        r, info = post_twilio_api(module, account_sid, auth_token, msg,
                from_number, number, media_url)
        if info['status'] not in [200, 201]:
            body_message = "unknown error"
            if 'body' in info:
                body = json.loads(info['body'])
                body_message = body['message']
            module.fail_json(msg="unable to send message to %s: %s" % (number, body_message))

    module.exit_json(msg=msg, changed=False)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
<commit_msg>Remove unused quotes - notification/twilio.py (#19152)<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2015, Matt Makai <matthew.makai@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible 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 Ansible.  If not, see <http://www.gnu.org/licenses/>.

ANSIBLE_METADATA = {'status': ['preview'],
                    'supported_by': 'community',
                    'version': '1.0'}

DOCUMENTATION = '''
---
version_added: "1.6"
module: twilio
short_description: Sends a text message to a mobile phone through Twilio.
description:
   - Sends a text message to a phone number through the Twilio messaging API.
notes:
   - This module is non-idempotent because it sends an email through the
     external API. It is idempotent only in the case that the module fails.
   - Like the other notification modules, this one requires an external
     dependency to work. In this case, you'll need a Twilio account with
     a purchased or verified phone number to send the text message.
options:
  account_sid:
    description:
      user's Twilio account token found on the account page
    required: true
  auth_token:
    description: user's Twilio authentication token
    required: true
  msg:
    description:
      the body of the text message
    required: true
  to_number:
    description:
      one or more phone numbers to send the text message to,
      format +15551112222
    required: true
  from_number:
    description:
      the Twilio number to send the text message from, format +15551112222
    required: true
  media_url:
    description:
      a URL with a picture, video or sound clip to send with an MMS
      (multimedia message) instead of a plain SMS
    required: false

author: "Matt Makai (@makaimc)"
'''

EXAMPLES = '''
# send an SMS about the build status to (555) 303 5681
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: All servers with webserver role are now configured.
    account_sid: ACXXXXXXXXXXXXXXXXX
    auth_token: ACXXXXXXXXXXXXXXXXX
    from_number: +15552014545
    to_number: +15553035681
  delegate_to: localhost

# send an SMS to multiple phone numbers about the deployment
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: This server configuration is now complete.
    account_sid: ACXXXXXXXXXXXXXXXXX
    auth_token: ACXXXXXXXXXXXXXXXXX
    from_number: +15553258899
    to_number:
      - +15551113232
      - +12025551235
      - +19735559010
  delegate_to: localhost

# send an MMS to a single recipient with an update on the deployment
# and an image of the results
# note: replace account_sid and auth_token values with your credentials
# and you have to have the 'from_number' on your Twilio account
- twilio:
    msg: Deployment complete!
    account_sid: ACXXXXXXXXXXXXXXXXX
    auth_token: ACXXXXXXXXXXXXXXXXX
    from_number: +15552014545
    to_number: +15553035681
    media_url: https://demo.twilio.com/logo.png
  delegate_to: localhost
'''

# =======================================
# twilio module support methods
#
import urllib

def post_twilio_api(module, account_sid, auth_token, msg, from_number,
                    to_number, media_url=None):
    URI = "https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json" \
        % (account_sid,)
    AGENT = "Ansible"

    data = {'From':from_number, 'To':to_number, 'Body':msg}
    if media_url:
        data['MediaUrl'] = media_url
    encoded_data = urllib.urlencode(data)

    headers = {'User-Agent': AGENT,
            'Content-type': 'application/x-www-form-urlencoded',
            'Accept': 'application/json',
            }

    # Hack module params to have the Basic auth params that fetch_url expects
    module.params['url_username'] = account_sid.replace('\n', '')
    module.params['url_password'] = auth_token.replace('\n', '')

    return fetch_url(module, URI, data=encoded_data, headers=headers)

# =======================================
# Main
#

def main():

    module = AnsibleModule(
        argument_spec=dict(
            account_sid=dict(required=True),
            auth_token=dict(required=True, no_log=True),
            msg=dict(required=True),
            from_number=dict(required=True),
            to_number=dict(required=True),
            media_url=dict(default=None, required=False),
        ),
        supports_check_mode=True
    )

    account_sid = module.params['account_sid']
    auth_token = module.params['auth_token']
    msg = module.params['msg']
    from_number = module.params['from_number']
    to_number = module.params['to_number']
    media_url = module.params['media_url']

    if not isinstance(to_number, list):
        to_number = [to_number]

    for number in to_number:
        r, info = post_twilio_api(module, account_sid, auth_token, msg,
                from_number, number, media_url)
        if info['status'] not in [200, 201]:
            body_message = "unknown error"
            if 'body' in info:
                body = json.loads(info['body'])
                body_message = body['message']
            module.fail_json(msg="unable to send message to %s: %s" % (number, body_message))

    module.exit_json(msg=msg, changed=False)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
<|endoftext|>


<commit_before>from setuptools import setup, find_packages

long_description = open('README.rst').read()

setup(name = 'prophy',
      packages = find_packages(),
      requires = ['ply'],
      install_requires = ['ply'],
      include_package_data = True,
      entry_points = {
          'console_scripts': [
              'prophyc = prophyc:main'
          ]
      },
      version = '0.4.1',
      description = 'prophy: fast data interchange format toolchain',
      long_description = long_description,
      author = 'Krzysztof Laskowski',
      author_email = 'krzysztof.laskowski@nsn.com',
      url = "https://github.com/aurzenligl/prophy",
      license = 'MIT license',
      keywords = "idl codec binary data protocol compiler",
      classifiers = [
            "Development Status :: 4 - Beta",
            "Intended Audience :: Developers",
            "Intended Audience :: Telecommunications Industry",
            "License :: OSI Approved :: MIT License",
            "Operating System :: Unix",
            "Operating System :: Microsoft :: Windows",
            "Programming Language :: Python :: 2.7",
            "Programming Language :: C++",
            "Topic :: Utilities",
            "Topic :: Software Development :: Libraries",
            "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
      ],
      zip_safe = False
)
<commit_msg>short package description rephrased<commit_after>from setuptools import setup, find_packages

long_description = open('README.rst').read()

setup(name = 'prophy',
      packages = find_packages(),
      requires = ['ply'],
      install_requires = ['ply'],
      include_package_data = True,
      entry_points = {
          'console_scripts': [
              'prophyc = prophyc:main'
          ]
      },
      version = '0.4.1',
      description = 'prophy: fast serialization protocol',
      long_description = long_description,
      author = 'Krzysztof Laskowski',
      author_email = 'krzysztof.laskowski@nsn.com',
      url = "https://github.com/aurzenligl/prophy",
      license = 'MIT license',
      keywords = "idl codec binary data protocol compiler",
      classifiers = [
            "Development Status :: 4 - Beta",
            "Intended Audience :: Developers",
            "Intended Audience :: Telecommunications Industry",
            "License :: OSI Approved :: MIT License",
            "Operating System :: Unix",
            "Operating System :: Microsoft :: Windows",
            "Programming Language :: Python :: 2.7",
            "Programming Language :: C++",
            "Topic :: Utilities",
            "Topic :: Software Development :: Libraries",
            "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
      ],
      zip_safe = False
)
<|endoftext|>


<commit_before>from distutils.core import setup
from setuptools import find_packages
import os
import sys

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

def find_packages_in(where, **kwargs):
    return [where] + ['%s.%s' % (where, package) for package in find_packages(where=where, **kwargs)]

setup(
    name = 'rhinocloud-utils',
    version = '0.1.8',
    author = 'Allan Lei',
    author_email = 'allanlei@helveticode.com',
    description = ('Django utility functions'),
    license = 'New BSD',
    keywords = 'utils django',
    url = 'https://github.com/allanlei/rhinocloud-utils',
    packages=find_packages_in('rhinocloud'),
    package_dir={'rhinocloud.contrib.jquery': 'rhinocloud/contrib/jquery'},
    package_data={'rhinocloud.contrib.jquery': ['templates/jquery/*.html']},
    long_description=read('README'),
    install_requires=[
        'gdata==2.0.14',
        'httplib2==0.6.0',      #gdata

        'pisa>=3.0.33',
        'html5lib==0.90',       #pisa
        'reportlab==2.5',       #pisa

        'wadofstuff-django-serializers>=1.1.0',
    ],
    classifiers=[
        'Development Status :: 3 - Alpha',
        'License :: OSI Approved :: BSD License',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',

        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
)
<commit_msg>update setup.py<commit_after>from distutils.core import setup
from setuptools import find_packages
import os
import sys

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

def find_packages_in(where, **kwargs):
    return [where] + ['%s.%s' % (where, package) for package in find_packages(where=where, **kwargs)]

setup(
    name = 'rhinocloud-utils',
    version = '0.1.9',
    author = 'Allan Lei',
    author_email = 'allanlei@helveticode.com',
    description = ('Django utility functions'),
    license = 'New BSD',
    keywords = 'utils django',
    url = 'https://github.com/allanlei/rhinocloud-utils',
    packages=find_packages_in('rhinocloud'),
    package_dir={'rhinocloud.contrib.jquery': 'rhinocloud/contrib/jquery'},
    package_data={'rhinocloud.contrib.jquery': ['templates/jquery/*.html']},
    long_description=read('README'),
    install_requires=[
        'gdata==2.0.14',
        'httplib2==0.6.0',      #gdata

        'pisa>=3.0.33',
        'html5lib==0.90',       #pisa
        'reportlab==2.5',       #pisa

        'wadofstuff-django-serializers>=1.1.0',
    ],
    classifiers=[
        'Development Status :: 3 - Alpha',
        'License :: OSI Approved :: BSD License',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',

        'Topic :: Software Development :: Libraries :: Python Modules',
    ],
)
<|endoftext|>


<commit_before>
from setuptools import setup, find_packages
import sys
import os
import glob
import configparser
import re
import shutil

conf = []
templates = []

long_description = '''EasyEngine is the commandline tool to manage your
                      Websites based on WordPress and Nginx with easy to use
                      commands'''

for name in glob.glob('config/plugins.d/*.conf'):
    conf.insert(1, name)

for name in glob.glob('ee/cli/templates/*.mustache'):
    templates.insert(1, name)

if not os.path.exists('/var/log/ee/'):
    os.makedirs('/var/log/ee/')

if not os.path.exists('/var/lib/ee/'):
    os.makedirs('/var/lib/ee/')

# EasyEngine git function
config = configparser.ConfigParser()
config.read(os.path.expanduser("~")+'/.gitconfig')
try:
    ee_user = config['user']['name']
    ee_email = config['user']['email']
except Exception as e:
    print("EasyEngine (ee) required your name & email address to track"
          " changes you made under the Git version control")
    print("EasyEngine (ee) will be able to send you daily reports & alerts in "
          "upcoming version")
    print("EasyEngine (ee) will NEVER send your information across")

    ee_user = input("Enter your name: ")
    while ee_user is "":
        print("Name not Valid, Please enter again")
        ee_user = input("Enter your name: ")

    ee_email = input("Enter your email: ")

    while not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$",
                       ee_email):
        print("Invalid email address, please try again")
        ee_email = input("Enter your email: ")

    os.system("git config --global user.name {0}".format(ee_user))
    os.system("git config --global user.email {0}".format(ee_email))

if not os.path.isfile('/root/.gitconfig'):
      shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig')

setup(name='ee',
      version='3.7.2',
      description=long_description,
      long_description=long_description,
      classifiers=[],
      keywords='',
      author='rtCamp Soultions Pvt. LTD',
      author_email='ee@rtcamp.com',
      url='http://rtcamp.com/easyengine',
      license='MIT',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests',
                                      'templates']),
      include_package_data=True,
      zip_safe=False,
      test_suite='nose.collector',
      install_requires=[
          # Required to build documentation
          # "Sphinx >= 1.0",
          # Required for testing
          # "nose",
          # "coverage",
          # Required to function
          'cement == 2.4',
          'pystache',
          'python-apt',
          'pynginxconfig',
          'pymysql3 == 0.4',
          'psutil == 3.1.1',
          'sh',
          'sqlalchemy',
          ],
      data_files=[('/etc/ee', ['config/ee.conf']),
                  ('/etc/ee/plugins.d', conf),
                  ('/usr/lib/ee/templates', templates),
                  ('/etc/bash_completion.d/',
                   ['config/bash_completion.d/ee_auto.rc']),
                  ('/usr/share/man/man8/', ['docs/ee.8'])],
      setup_requires=[],
      entry_points="""
          [console_scripts]
          ee = ee.cli.main:main
      """,
      namespace_packages=[],
      )
<commit_msg>update ee version<commit_after>
from setuptools import setup, find_packages
import sys
import os
import glob
import configparser
import re
import shutil

conf = []
templates = []

long_description = '''EasyEngine is the commandline tool to manage your
                      Websites based on WordPress and Nginx with easy to use
                      commands'''

for name in glob.glob('config/plugins.d/*.conf'):
    conf.insert(1, name)

for name in glob.glob('ee/cli/templates/*.mustache'):
    templates.insert(1, name)

if not os.path.exists('/var/log/ee/'):
    os.makedirs('/var/log/ee/')

if not os.path.exists('/var/lib/ee/'):
    os.makedirs('/var/lib/ee/')

# EasyEngine git function
config = configparser.ConfigParser()
config.read(os.path.expanduser("~")+'/.gitconfig')
try:
    ee_user = config['user']['name']
    ee_email = config['user']['email']
except Exception as e:
    print("EasyEngine (ee) required your name & email address to track"
          " changes you made under the Git version control")
    print("EasyEngine (ee) will be able to send you daily reports & alerts in "
          "upcoming version")
    print("EasyEngine (ee) will NEVER send your information across")

    ee_user = input("Enter your name: ")
    while ee_user is "":
        print("Name not Valid, Please enter again")
        ee_user = input("Enter your name: ")

    ee_email = input("Enter your email: ")

    while not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$",
                       ee_email):
        print("Invalid email address, please try again")
        ee_email = input("Enter your email: ")

    os.system("git config --global user.name {0}".format(ee_user))
    os.system("git config --global user.email {0}".format(ee_email))

if not os.path.isfile('/root/.gitconfig'):
      shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig')

setup(name='ee',
      version='3.7.3',
      description=long_description,
      long_description=long_description,
      classifiers=[],
      keywords='',
      author='rtCamp Soultions Pvt. LTD',
      author_email='ee@rtcamp.com',
      url='http://rtcamp.com/easyengine',
      license='MIT',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests',
                                      'templates']),
      include_package_data=True,
      zip_safe=False,
      test_suite='nose.collector',
      install_requires=[
          # Required to build documentation
          # "Sphinx >= 1.0",
          # Required for testing
          # "nose",
          # "coverage",
          # Required to function
          'cement == 2.4',
          'pystache',
          'python-apt',
          'pynginxconfig',
          'pymysql3 == 0.4',
          'psutil == 3.1.1',
          'sh',
          'sqlalchemy',
          ],
      data_files=[('/etc/ee', ['config/ee.conf']),
                  ('/etc/ee/plugins.d', conf),
                  ('/usr/lib/ee/templates', templates),
                  ('/etc/bash_completion.d/',
                   ['config/bash_completion.d/ee_auto.rc']),
                  ('/usr/share/man/man8/', ['docs/ee.8'])],
      setup_requires=[],
      entry_points="""
          [console_scripts]
          ee = ee.cli.main:main
      """,
      namespace_packages=[],
      )
<|endoftext|>


<commit_before>#from distutils.core import setup
from setuptools import setup

def make_data_file_list(target, source):
    import os

    def visit(destination_directory, source_directory):
        # print destination_directory + " " + source_directory
        files = os.listdir(source_directory)
        data_file_list = []
        todo = []
        for file_name in files:
            # print type(file_name)
            source_file = os.path.join(source_directory, file_name)
            # print "source_file " + source_file
            next_destination_directory = os.path.join(destination_directory,file_name)

            if file_name.startswith("__") and file_name != '__init__.py':
                pass
            elif os.path.isdir(source_file):
                data_file_list.append((next_destination_directory,[]))
                todo.append((next_destination_directory,source_file))
            elif os.path.isfile(source_file):
                data_file_list.append((destination_directory,[source_file]))

        for next_target, next_source in todo:
            data_file_list += visit(next_target, next_source)

        return data_file_list

    return visit(target, source)

data_file_list = make_data_file_list("ctree/tools/generators/templates","ctree/tools/generators/templates")
# import pprint
# pprint.pprint(data_file_list)

setup(
    name='ctree',
    version='0.95a',

    packages=[
        'ctree',
        'ctree.c',
        'ctree.cilk',
        'ctree.cpp',
        'ctree.ocl',
        'ctree.omp',
        'ctree.py',
        'ctree.simd',
        'ctree.templates',
        'ctree.opentuner',
        'ctree.metrics',
        'ctree.tools',
        'ctree.tools.generators',
        'ctree.visual',
    ],

    package_data={
        'ctree': ['defaults.cfg'],
    },

    install_requires=[
        'numpy',
        'mako',
        'pyserial',
        # 'readline',
    ],

    data_files=data_file_list,

    entry_points={
        'console_scripts': ['ctree = ctree.tools.runner:main'],
    }
)
<commit_msg>Cleanup and document setup function that sets up file copy<commit_after>#from distutils.core import setup
from setuptools import setup

def make_data_file_list(target, source):
    """
    creates a list of tuples (target_directory, file_list)
    that setup should copy into the egg in
    the install process.  Gets around no way to specify a recursive
    directory tree copy, directories must be created by
    name on left side of tuple against an empty file list on the right
    """
    import os

    def visit(destination_directory, source_directory):
        # print destination_directory + " " + source_directory
        files = os.listdir(source_directory)
        transfer_list = []
        todo = []
        for file_name in files:
            # print type(file_name)
            source_file = os.path.join(source_directory, file_name)
            # print "source_file " + source_file
            next_destination_directory = os.path.join(destination_directory, file_name)

            if file_name.startswith("__") and file_name != '__init__.py':
                pass
            elif os.path.isdir(source_file):
                transfer_list.append((next_destination_directory, []))
                todo.append((next_destination_directory, source_file))
            elif os.path.isfile(source_file):
                transfer_list.append((destination_directory, [source_file]))

        for next_target, next_source in todo:
            transfer_list += visit(next_target, next_source)

        return transfer_list

    return visit(target, source)

data_file_list = make_data_file_list("ctree/tools/generators/templates", "ctree/tools/generators/templates")
# import pprint
# pprint.pprint(data_file_list)

setup(
    name='ctree',
    version='0.95a',

    packages=[
        'ctree',
        'ctree.c',
        'ctree.cilk',
        'ctree.cpp',
        'ctree.ocl',
        'ctree.omp',
        'ctree.py',
        'ctree.simd',
        'ctree.templates',
        'ctree.opentuner',
        'ctree.metrics',
        'ctree.tools',
        'ctree.tools.generators',
        'ctree.visual',
    ],

    package_data={
        'ctree': ['defaults.cfg'],
    },

    install_requires=[
        'numpy',
        'mako',
        'pyserial',
        # 'readline',
    ],

    data_files=data_file_list,

    entry_points={
        'console_scripts': ['ctree = ctree.tools.runner:main'],
    }
)
<|endoftext|>


<commit_before>try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

from azurectl.version import __VERSION__

config = {
    'description': 'Manage Azure PubCloud Service',
    'author': 'PubCloud Development team',
    'url': 'https://github.com/SUSE/azurectl',
    'download_url': 'https://github.com/SUSE/azurectl',
    'author_email': 'public-cloud-dev@susecloud.net',
    'version': __VERSION__,
    'install_requires': [
        'docopt==0.6.2',
        'APScheduler==3.0.2',
        'pyliblzma==0.5.3',
        'azure==0.11.0',
        'python-dateutil==2.1'
    ],
    'packages': ['azurectl'],
    'entry_points': {
        'console_scripts': ['azurectl=azurectl.azurectl:main'],
    },
    'name': 'azurectl'
}

setup(**config)
<commit_msg>Increment azure-sdk dependency to match version in OBS.<commit_after>try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

from azurectl.version import __VERSION__

config = {
    'description': 'Manage Azure PubCloud Service',
    'author': 'PubCloud Development team',
    'url': 'https://github.com/SUSE/azurectl',
    'download_url': 'https://github.com/SUSE/azurectl',
    'author_email': 'public-cloud-dev@susecloud.net',
    'version': __VERSION__,
    'install_requires': [
        'docopt==0.6.2',
        'APScheduler==3.0.2',
        'pyliblzma==0.5.3',
        'azure==0.11.1',
        'python-dateutil==2.1'
    ],
    'packages': ['azurectl'],
    'entry_points': {
        'console_scripts': ['azurectl=azurectl.azurectl:main'],
    },
    'name': 'azurectl'
}

setup(**config)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages

setup(
    name = "django-waitinglist",
    version = "1.0b8",
    author = "Brian Rosner",
    author_email = "brosner@gmail.com",
    description = "a Django waiting list app for running a private beta with cohorts support",
    long_description = open("README.rst").read(),
    license = "MIT",
    url = "http://github.com/pinax/django-waitinglist",
    packages = find_packages(),
    install_requires = [
        "django-appconf==0.5",
    ],
    classifiers = [
        "Development Status :: 4 - Beta",
        "Environment :: Web Environment",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Framework :: Django",
    ]
)<commit_msg>Fix packaging (again) - 1.0b9<commit_after>from setuptools import setup, find_packages

setup(
    name = "django-waitinglist",
    version = "1.0b9",
    author = "Brian Rosner",
    author_email = "brosner@gmail.com",
    description = "a Django waiting list app for running a private beta with cohorts support",
    long_description = open("README.rst").read(),
    license = "MIT",
    url = "http://github.com/pinax/django-waitinglist",
    packages = find_packages(),
    package_data = {"waitinglist": ["waitinglist/templates/*"]},
    install_requires = [
        "django-appconf==0.5",
    ],
    classifiers = [
        "Development Status :: 4 - Beta",
        "Environment :: Web Environment",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Framework :: Django",
    ]
)<|endoftext|>


<commit_before># -*- coding: utf-8 -*-

import os
from setuptools import setup
from setuptools import find_packages

def read_version():
    src_dir = os.path.abspath(os.path.dirname(__file__))
    ver_file = os.path.join(src_dir, 'sklearn_porter', '__version__.txt')
    version = open(ver_file, 'r').readlines().pop()
    if isinstance(version, bytes):
        version = version.decode('utf-8')
    version = str(version).strip()
    return version

def parse_requirements():
    src_dir = os.path.abspath(os.path.dirname(__file__))
    req_file = os.path.join(src_dir, 'requirements.txt')
    reqs = open(req_file, 'r').read().strip().split('\n')
    reqs = [req.strip() for req in reqs if 'git+' not in req]
    return reqs

setup(
    name='sklearn-porter',
    packages=find_packages(exclude=["tests.*", "tests"]),
    include_package_data=True,
    version=read_version(),
    description='Transpile trained scikit-learn models to C, Java, JavaScript and others.',
    author='Darius Morawiec',
    author_email='ping@nok.onl',
    url='https://github.com/nok/sklearn-porter/tree/stable',
    classifiers=[
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
    install_requires=parse_requirements(),
    keywords=['sklearn', 'scikit-learn'],
    license='MIT',
)
<commit_msg>master: Add type hints<commit_after># -*- coding: utf-8 -*-

import os
from setuptools import setup
from setuptools import find_packages
from typing import List

def read_version():
    # type: () -> str
    """Read the module version from __version__.txt"""
    src_dir = os.path.abspath(os.path.dirname(__file__))
    ver_file = os.path.join(src_dir, 'sklearn_porter', '__version__.txt')
    version = open(ver_file, 'r').readlines().pop()
    if isinstance(version, bytes):
        version = version.decode('utf-8')
    version = str(version).strip()
    return version

def parse_requirements():
    # type: () -> List[str]
    """Parse the modules from requirements.txt"""
    src_dir = os.path.abspath(os.path.dirname(__file__))
    req_file = os.path.join(src_dir, 'requirements.txt')
    reqs = open(req_file, 'r').read().strip().split('\n')
    reqs = [req.strip() for req in reqs if 'git+' not in req]
    return reqs

setup(
    name='sklearn-porter',
    packages=find_packages(exclude=["tests.*", "tests"]),
    include_package_data=True,
    version=read_version(),
    description='Transpile trained scikit-learn models to C, Java, JavaScript and others.',
    author='Darius Morawiec',
    author_email='ping@nok.onl',
    url='https://github.com/nok/sklearn-porter/tree/stable',
    classifiers=[
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
    install_requires=parse_requirements(),
    keywords=['sklearn', 'scikit-learn'],
    license='MIT',
)
<|endoftext|>


<commit_before>import os

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

# Utility function to read the README file, used for the long desc.
def read(fn):
    return open(os.path.join(os.path.dirname(__file__), fn)).read()

setup(
    name='planet_alignment',
    version='1.0.0',
    packages=[
        'planet_alignment',
        'planet_alignment.app',
        'planet_alignment.cmd',
        'planet_alignment.config',
        'planet_alignment.data',
        'planet_alignment.mgr',
        'planet_alignment.plugins',
        'planet_alignment.test',
        'planet_alignment.utils'
    ],
    url='https://github.com/paulfanelli/planet_alignment.git',
    license='MIT',
    author='Paul Fanelli',
    author_email='paul.fanelli@gmail.com',
    description='Planet Alignment program',
    long_description=read('README'),
    install_requires=['bunch', 'zope.interface', 'PyYAML'],
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'planet_alignment = planet_alignment.__main__:main'
        ]
    },
    include_package_data=True
)
<commit_msg>Add a data_files option to install the config and plugin files in /etc/planet_alignment.<commit_after>import os

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

# Utility function to read the README file, used for the long desc.
def read(fn):
    return open(os.path.join(os.path.dirname(__file__), fn)).read()

setup(
    name='planet_alignment',
    version='1.0.0',
    packages=[
        'planet_alignment',
        'planet_alignment.app',
        'planet_alignment.cmd',
        'planet_alignment.config',
        'planet_alignment.data',
        'planet_alignment.mgr',
        'planet_alignment.plugins',
        'planet_alignment.test',
        'planet_alignment.utils'
    ],
    url='https://github.com/paulfanelli/planet_alignment.git',
    license='MIT',
    author='Paul Fanelli',
    author_email='paul.fanelli@gmail.com',
    description='Planet Alignment program',
    long_description=read('README'),
    install_requires=['bunch', 'zope.interface', 'PyYAML'],
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'planet_alignment = planet_alignment.__main__:main'
        ]
    },
    include_package_data=True,
    data_files=[
        ('/etc/planet_alignment', ['align1.py', 'align2.py', 'system.yaml'])
    ]
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, "README.rst")) as f:
    long_description = f.read()

setup(name = "pychal",
    description = "Drop-in replacement of pychallonge",
    long_description = long_description,
    author = "ZEDGR",
    author_email = "georlema@gmail.com",
    url = "https://github.com/ZEDGR/pychal",
    license = "Public Domain",
    version = "1.9.0",
    keywords = ['tournaments', 'challonge'],
    packages = find_packages(),
    platforms=['any'],
    classifiers = [
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: Public Domain',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6'
    ],
    install_requires = [
        'iso8601==0.1.12',
        'tzlocal==2.0.0',
        'pytz==2019.3',
        'requests==2.23.0',
    ],
)
<commit_msg>update setup.py to version 1.10.0<commit_after>from setuptools import setup, find_packages
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, "README.rst")) as f:
    long_description = f.read()

setup(name = "pychal",
    description = "Drop-in replacement of pychallonge",
    long_description = long_description,
    author = "ZEDGR",
    author_email = "georlema@gmail.com",
    url = "https://github.com/ZEDGR/pychal",
    license = "Public Domain",
    version = "1.10.0",
    keywords = ['tournaments', 'challonge'],
    packages = find_packages(),
    platforms=['any'],
    classifiers = [
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: Public Domain',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6'
    ],
    install_requires = [
        'iso8601==0.1.12',
        'tzlocal==2.0.0',
        'pytz==2019.3',
        'requests==2.23.0',
    ],
)
<|endoftext|>


<commit_before># Copyright (c) 2014. Mount Sinai School of Medicine
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

readme_filename = os.path.join(os.path.dirname(__file__), 'README.md')
with open(readme_filename, 'r') as f:
  readme = f.read()

try:
  import pypandoc
  readme = pypandoc.convert(readme, to='rst', format='md')
except:
  print "Conversion of long_description from markdown to reStructuredText failed, skipping..."
  pass

from setuptools import setup

if __name__ == '__main__':
    setup(
        name='ensembl',
        version="0.2",
        description="Python interface to ensembl reference genome metadata",
        url="https://github.com/hammerlab/ensembl",
        license="http://www.apache.org/licenses/LICENSE-2.0.html",
        classifiers=[
            'Development Status :: 3 - Alpha',
            'Environment :: Console',
            'Operating System :: OS Independent',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: Apache License',
            'Programming Language :: Python',
            'Topic :: Scientific/Engineering :: Bio-Informatics',
             ],
        requires=[
            'numpy(>=1.7)',
            'pandas(>=0.13.1)',
	    'datacache',
        ],
        long_description=readme,
        packages=['ensembl'],
    )
<commit_msg>version bump<commit_after># Copyright (c) 2014. Mount Sinai School of Medicine
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

readme_filename = os.path.join(os.path.dirname(__file__), 'README.md')
with open(readme_filename, 'r') as f:
  readme = f.read()

try:
  import pypandoc
  readme = pypandoc.convert(readme, to='rst', format='md')
except:
  print "Conversion of long_description from markdown to reStructuredText failed, skipping..."
  pass

from setuptools import setup

if __name__ == '__main__':
    setup(
        name='ensembl',
        version="0.3",
        description="Python interface to ensembl reference genome metadata",
        url="https://github.com/hammerlab/ensembl",
        license="http://www.apache.org/licenses/LICENSE-2.0.html",
        classifiers=[
            'Development Status :: 3 - Alpha',
            'Environment :: Console',
            'Operating System :: OS Independent',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: Apache License',
            'Programming Language :: Python',
            'Topic :: Scientific/Engineering :: Bio-Informatics',
             ],
        requires=[
            'numpy(>=1.7)',
            'pandas(>=0.13.1)',
	    'datacache',
        ],
        long_description=readme,
        packages=['ensembl'],
    )
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-

"""
A setuptools based setup module for opengrid.

Adapted from
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
#with open(path.join(here, 'README.md'), encoding='utf-8') as f:
#    long_description = f.read()

import subprocess
if subprocess.call(["pip", "install","-r", path.join(here, "requirements.txt"), "-v", "--no-cache"]):
    raise Exception("Could not install dependencies")

setup(
    name='opengrid',
    version="0.4.0",
    description='Open-source algorithms for data-driven building analysis and control',
    #long_description=long_description,
    url='https://github.com/opengridcc/opengrid',
    author='Roel De Coninck and many others',
    author_email='roeldeconinck@gmail.com',
    license='Apache 2.0',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Topic :: Scientific/Engineering',

        # Pick your license as you wish (should match "license" above)
        'License :: OSI Approved :: Apache Software License',

        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
    ],

    keywords='algorithms buildings monitoring analysis control',

    # You can just specify the packages manually here if your project is
    # simple. Or you can use find_packages().
    packages=find_packages(),

    # Alternatively, if you want to distribute just a my_module.py, uncomment
    # this:
    #py_modules=["tmpo.py"],

    # If there are data files included in your packages that need to be
    # installed, specify them here.  If using Python 2.6 or less, then these
    # have to be included in MANIFEST.in as well.
    # Note: for creating the source distribution, they had to be included in the
    # MANIFEST.in as well.
    package_data={
        'opengrid': ['LICENSE', 'README.md', 'requirements.txt', 'opengrid/library/houseprint/tests/test_saved_hp.hp',
                     'opengrid/library/tests/*', 'opengrid/library/tests/data/*', 'opengrid/library/tests/data/cache_day/*',
                     'notebooks/*'],
    },
)
<commit_msg>Version increase to 0.4.1<commit_after># -*- coding: utf-8 -*-

"""
A setuptools based setup module for opengrid.

Adapted from
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
#with open(path.join(here, 'README.md'), encoding='utf-8') as f:
#    long_description = f.read()

import subprocess
if subprocess.call(["pip", "install","-r", path.join(here, "requirements.txt"), "-v", "--no-cache"]):
    raise Exception("Could not install dependencies")

setup(
    name='opengrid',
    version="0.4.1",
    description='Open-source algorithms for data-driven building analysis and control',
    #long_description=long_description,
    url='https://github.com/opengridcc/opengrid',
    author='Roel De Coninck and many others',
    author_email='roeldeconinck@gmail.com',
    license='Apache 2.0',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Topic :: Scientific/Engineering',

        # Pick your license as you wish (should match "license" above)
        'License :: OSI Approved :: Apache Software License',

        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
    ],

    keywords='algorithms buildings monitoring analysis control',

    # You can just specify the packages manually here if your project is
    # simple. Or you can use find_packages().
    packages=find_packages(),

    # Alternatively, if you want to distribute just a my_module.py, uncomment
    # this:
    #py_modules=["tmpo.py"],

    # If there are data files included in your packages that need to be
    # installed, specify them here.  If using Python 2.6 or less, then these
    # have to be included in MANIFEST.in as well.
    # Note: for creating the source distribution, they had to be included in the
    # MANIFEST.in as well.
    package_data={
        'opengrid': ['LICENSE', 'README.md', 'requirements.txt', 'opengrid/library/houseprint/tests/test_saved_hp.hp',
                     'opengrid/library/tests/*', 'opengrid/library/tests/data/*', 'opengrid/library/tests/data/cache_day/*',
                     'notebooks/*'],
    },
)
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages

with open('README.rst', 'rb') as readme:
    readme_text = readme.read().decode('utf-8')

setup(
    name='django-bootstrap-pagination',
    version='1.5.2',
    keywords="django bootstrap pagination templatetag",
    author=u'Jason McClellan',
    author_email='jason@jasonmccllelan.net',
    packages=find_packages(),
    url='https://github.com/jmcclell/django-bootstrap-pagination',
    license='MIT licence, see LICENCE',
    description='Render Django Page objects as Bootstrap 3.x Pagination compatible HTML',
    long_description=readme_text,
    zip_safe=False,
    include_package_data=True,
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Framework :: Django",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
    ]
)
<commit_msg>Prepare for 1.6.0 on pypi<commit_after># -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages

with open('README.rst', 'rb') as readme:
    readme_text = readme.read().decode('utf-8')

setup(
    name='django-bootstrap-pagination',
    version='1.6.0',
    keywords="django bootstrap pagination templatetag",
    author=u'Jason McClellan',
    author_email='jason@jasonmccllelan.net',
    packages=find_packages(),
    url='https://github.com/jmcclell/django-bootstrap-pagination',
    license='MIT licence, see LICENCE',
    description='Render Django Page objects as Bootstrap 3.x Pagination compatible HTML',
    long_description=readme_text,
    zip_safe=False,
    include_package_data=True,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Framework :: Django",
        "Framework :: Django :: 1.4",
        "Framework :: Django :: 1.5",
        "Framework :: Django :: 1.6",
        "Framework :: Django :: 1.7",
        "Framework :: Django :: 1.8",
        "Framework :: Django :: 1.9",
        "Programming Language :: Python :: 2.6",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3.2",
        "Programming Language :: Python :: 3.3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
    ]
)
<|endoftext|>