Esempio n. 1
0
    def initialize_sys_path_odoo_addons():
        initialize_sys_path_orig()

        ad_paths = openerp.modules.module.ad_paths

        try:
            # explicit workaround for https://github.com/pypa/pip/issues/3 and
            # https://github.com/pypa/setuptools/issues/250 (it sort of works
            # without this but I'm not sure why, so better be safe)
            pkg_resources.declare_namespace('odoo_addons')

            for ad in __import__('odoo_addons').__path__:
                ad = os.path.abspath(ad)
                if ad not in ad_paths:
                    ad_paths.append(ad)
        except ImportError:
            # odoo_addons is not provided by any distribution
            pass
Esempio n. 2
0
  def _declare_namespace_packages(resolved_dists):
    namespace_package_dists = [dist for dist in resolved_dists
                               if dist.has_metadata('namespace_packages.txt')]
    if not namespace_package_dists:
      return  # Nothing to do here.

    # When declaring namespace packages, we need to do so with the `setuptools` distribution that
    # will be active in the pex environment at runtime and, as such, care must be taken.
    #
    # Properly behaved distributions will declare a dependency on `setuptools`, in which case we
    # use that (non-vendored) distribution. A side-effect of importing `pkg_resources` from that
    # distribution is that a global `pkg_resources.working_set` will be populated. For various
    # `pkg_resources` distribution discovery functions to work, that global
    # `pkg_resources.working_set` must be built with the `sys.path` fully settled. Since all dists
    # in the dependency set (`resolved_dists`) have already been resolved and added to the
    # `sys.path` we're safe to proceed here.
    #
    # Other distributions (notably `twitter.common.*`) in the wild declare `setuptools`-specific
    # `namespace_packages` but do not properly declare a dependency on `setuptools` which they must
    # use to:
    # 1. Declare `namespace_packages` metadata which we just verified they have with the check
    #    above.
    # 2. Declare namespace packages at runtime via the canonical:
    #    `__import__('pkg_resources').declare_namespace(__name__)`
    #
    # For such distributions we fall back to our vendored version of `setuptools`. This is safe,
    # since we'll only introduce our shaded version when no other standard version is present and
    # even then tear it all down when we hand off from the bootstrap to user code.
    pkg_resources, vendored = _import_pkg_resources()
    if vendored:
      pex_warnings.warn('The `pkg_resources` package was loaded from a pex vendored version when '
                        'declaring namespace packages defined by {dists}. These distributions '
                        'should fix their `install_requires` to include `setuptools`'
                        .format(dists=namespace_package_dists))

    for dist in namespace_package_dists:
      for pkg in dist.get_metadata_lines('namespace_packages.txt'):
        if pkg in sys.modules:
          pkg_resources.declare_namespace(pkg)
Esempio n. 3
0
from importlib import import_module
from setuptools import setup, find_packages
import pkg_resources

spicy_pkg = import_module('src.spicy')
version = import_module('src.spicy.version').__version__

long_description = """spicy core package"""

pkg_resources.declare_namespace('spicy')


def long_description():
    """Return long description from README.rst if it's present
    because it doesn't get installed."""
    try:
        return open('README.rst').read()
    except IOError:
        return long_description


setup(
    name='spicy',
    version=version,

    author='Burtsev Alexander',
    author_email='*****@*****.**',
    description='spicy',
    license='BSD',
    keywords='django, cms',
    url='', # TODO: define an url
Esempio n. 4
0
from pkg_resources import declare_namespace; declare_namespace(__name__)
Esempio n. 5
0
try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('mars')
except ImportError:
    pass

Esempio n. 6
0
try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('zojax')
except ImportError:
    pass
Esempio n. 7
0
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--

import sys

try:
    import stackless
except ImportError:
    print 'You must use Python Stackless !'
    print 'Get it at http://www.stackless.com'
    sys.exit(-1)

if sys.version_info < (2, 5, 2):
    print 'The version of Stackless Python must be 2.5.2 or more'
    sys.exit(-2)

# -----------------------------------------------------------------------------

import pkg_resources

pkg_resources.declare_namespace('nagare')

# -----------------------------------------------------------------------------

import mimetypes

# Fix issue 5868 in Python 2.6.2 (http://bugs.python.org/issue5868)
mimetypes.init()
Esempio n. 8
0
# -*- coding: utf-8 -*-

try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('kooaba')
except ImportError:
    pass
Esempio n. 9
0
#
# soaplib - Copyright (C) Soaplib contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
#

try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('soaplib')
except ImportError:
    pass
Esempio n. 10
0
        sys.executable + " -m pip install jinja2", shell=True
    )  # Use shell to use venv if available
    from jinja2 import Template, FileSystemLoader, Environment


try:
    import azure.common
except:
    sys.path.append(
        str((Path(__file__).parents[1] / "sdk" / "core" / "azure-common").resolve())
    )
    import azure.common

import pkg_resources

pkg_resources.declare_namespace("azure")

_LOGGER = logging.getLogger(__name__)


def parse_input(input_parameter):
    """From a syntax like package_name#submodule, build a package name
    and complete module name.
    """
    split_package_name = input_parameter.split("#")
    package_name = split_package_name[0]
    module_name = package_name.replace("-", ".")
    if len(split_package_name) >= 2:
        module_name = ".".join([module_name, split_package_name[1]])
    return package_name, module_name
Esempio n. 11
0
# along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA.
#
# Authors:
#     Santiago Dueñas <*****@*****.**>
#

import datetime
import dateutil
import httpretty
import os
import pkg_resources
import unittest
import unittest.mock

pkg_resources.declare_namespace('perceval.backends')

from perceval.backend import BackendCommandArgumentParser
from perceval.utils import DEFAULT_DATETIME
from perceval.backends.core.slack import (Slack, SlackClient, SlackClientError,
                                          SlackCommand)
from base import TestCaseBackendArchive

SLACK_API_URL = 'https://slack.com/api'
SLACK_CHANNEL_INFO_URL = SLACK_API_URL + '/channels.info'
SLACK_CHANNEL_HISTORY_URL = SLACK_API_URL + '/channels.history'
SLACK_USER_INFO_URL = SLACK_API_URL + '/users.info'


def read_file(filename, mode='r'):
    with open(
Esempio n. 12
0
>>> from vsc.ldap.utils import LdapQuery
>>> uc = LdapConfiguration(url='ldap.eid.belgium.be', connection_dn='dc=eid,dc=belgium,dc=be')
>>> l = LdapQuery(uc)
>>> l.user_filter_search('sn=Smith')
[{}]


@author: Andy Georges
@author: Stijn De Weirdt
@author: Jens Timmerman
"""

#the vsc.ldap namespace is used in different folders allong the system
#so explicitly declare this is also the vsc namespace
import pkg_resources
pkg_resources.declare_namespace(__name__)


class NoSuchUserError(Exception):
    """If a user cannot be found in the LDAP."""
    def __init__(self, name):
        """Initialisation."""
        super(NoSuchUserError, self).__init__()
        self.name = name


class UserAlreadyExistsError(Exception):
    """If a user already is present in the LDAP, i.e., the dn already exists."""
    def __init__(self, name):
        """Initialisation."""
        super(UserAlreadyExistsError, self).__init__()
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
#
# This file is necessary to make this directory a package.

try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('zope')
except ImportError:
    pass
Esempio n. 14
0
try:
    from pkg_resources import declare_namespace
    declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)

from .fm import *
Esempio n. 15
0
# Copyright 2011 The greplin-tornado-stripe Authors.
#
# 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.
"""The Greplin root package."""

import pkg_resources
pkg_resources.declare_namespace('greplin.tornado')
Esempio n. 16
0
import pkg_resources
pkg_resources.declare_namespace('tasker')
from pkg_resources import declare_namespace

declare_namespace('testsuite')
Esempio n. 18
0
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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 sys

__version__ = '0.2.9'
__all__ = ['ODPS',]

version = sys.version_info
if version[0] == 2 and version[:2] < (2, 6):
    raise Exception('pyodps supports python 2.6+ (including python 3+).')

import pkg_resources
pkg_resources.declare_namespace(__name__)

from .core import ODPS
from .config import options
from pkg_resources import declare_namespace

declare_namespace('testsuite.prettyprint')
Esempio n. 20
0
#@author: Jean-Lou Dupont
try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('pyjld')
except ImportError:
    pass
# Copyright 2011 The greplin-tornado-kissmetrics Authors.
#
# 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.

"""The Greplin tornado package."""

import pkg_resources

pkg_resources.declare_namespace("greplin.tornado")
Esempio n. 22
0
#
# growler/middleware/__init__.py
#
# flake8: noqa
#
"""
Implementation of default middleware along with the virtual package for
others to extend growler middleware with their own packages.
"""

import growler

from .auth import Auth
from .static import Static
from .logger import Logger
from .renderer import Renderer
from .session import (Session, SessionStorage, DefaultSessionStorage)
from .cookieparser import CookieParser
from .responsetime import ResponseTime
from .timer import Timer

from pkg_resources import declare_namespace

declare_namespace('growler.middleware')

__all__ = ['Logger']
Esempio n. 23
0
#!/usr/bin/env python
#
# Copyright 2016 Rafe Kaplan
#
# 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 pkg_resources

from .proputils import *
from .propval import *

pkg_resources.declare_namespace('sordid.props')
Esempio n. 24
0
# Copyright 2011 The greplin-twisted-utils Authors.
#
# 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.

"""The Greplin testing package."""

import pkg_resources
pkg_resources.declare_namespace('greplin.testing')
Esempio n. 25
0
import atexit
import logging
import functools
import pkg_resources

# Odoo package import and start services logic are based on code:
#     https://github.com/tinyerp/erppeek
# With PR #92 applied: https://github.com/tinyerp/erppeek/pull/92
# Removed support of Odoo versions less then 8.0

# Import odoo package
try:
    # Odoo 10.0+

    # this is required if there are addons installed via setuptools_odoo
    pkg_resources.declare_namespace('odoo.addons')

    # import odoo itself
    import odoo
    import odoo.release  # to avoid 9.0 with odoo.py on path
except (ImportError, KeyError):
    try:
        # Odoo 9.0 and less versions
        import openerp as odoo
    except ImportError:
        raise

if odoo.release.version_info < (8, ):
    raise ImportError("Odoo version %s is not supported!" %
                      odoo.release.version_info)
Esempio n. 26
0
__all__ = ['pathoid', 'patholib', 'pathoqc', 'pathomap', 'pathoassem', 'pathoreport','utils','pathodb']
#import pathoid
#import patholib
#import pathomap
#import pathoassem
#import pathoreport
#import utils
#import pathodb
#import pathoqc
#
import pkg_resources

pkg_resources.declare_namespace("pathoscope")
Esempio n. 27
0
#!/usr/bin/env python
#
# Copyright 2017 Rafe Kaplan
#
# 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 pkg_resources

pkg_resources.declare_namespace('sordid')
Esempio n. 28
0
from pkg_resources import declare_namespace
declare_namespace('csvimport')
import csvimport.monkeypatch_tzinfo
# Allow for the management commands to import these ...
from parser import CSVParser
from make_model import MakeModel
Esempio n. 29
0
#
# growler/ext/__init__.py
#
"""
Virtual namespace for other pacakges to extend the growler server
"""

from pkg_resources import declare_namespace

declare_namespace('growler.ext')
#    execfile("D:/Repositories/JCU-DC24/venv/Scripts/activate_this.py", dict(__file__="D:/Repositories/JCU-DC24/venv/Scripts/activate_this.py"))
    execfile("../../venv/Scripts/activate_this.py", dict(__file__="../../venv/Scripts/activate_this.py"))
except Exception as e:
    logger.exception("Virtual env activation failed, please update the activate_this.py address in the base __init__ if developing on a windows machine.")

import jcudc24provisioning
from deform.form import Form
from pyramid.config import Configurator
from pkg_resources import resource_filename
from pyramid_beaker import session_factory_from_settings, set_cache_regions_from_settings

from pkg_resources import declare_namespace
import sys
import scripts.initializedb

declare_namespace('jcudc24provisioning')

__author__ = 'Casey Bajema'

def set_global_settings(settings):
    """
    Responsible for validating settings, and if there are no error, 
    setting the global settings variable
    """
    errors = []
    warns = []
    
    # Data portal
    if "dataportal.home_url" not in settings:
        warns.append("dataportal.home_url not set - linkages to the data portal home page will be disabled")
    if "dataportal.dataset_url" not in settings:
Esempio n. 31
0
import pkg_resources; pkg_resources.declare_namespace(__name__)
Esempio n. 32
0
# ---------------------------------------------------------------------------------------------------------------------
#
# Copyright (C) 2016 aerial
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# ---------------------------------------------------------------------------------------------------------------------

"""aerial namespace definition."""

from pkg_resources import declare_namespace
from pkgutil import extend_path

# noinspection PyUnboundLocalVariable
__path__ = extend_path(__path__, __name__)

declare_namespace('aerial')
Esempio n. 33
0
#
# Copyright (c) 2014, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope 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.
#

"""
Init.
Namespace declaration.
"""

import pkg_resources

pkg_resources.declare_namespace("pem")
Esempio n. 34
0
  dll = DLinklist()
  dll.create(sizeof(Info))

And you are done, just call any method in the C{DLinklist} class on the
C{dll} object.

@note: All the C{pFun} objects in the API need to return C{< 0}, C{0}, and
       C{> 0} as in the Python I{cmp} function. The C{compare} method in the
       API is very basic, so you will probably need to write your own. However,
       use the C{compare} method in the source code as an example of how it
       should be written.
"""

import pkg_resources as _res

_res.declare_namespace(__name__)
_RES_PATH = _res.resource_filename(__name__, "libdll.so")

from linklist import Return, SrchOrigin, SrchDir, InsertDir, Info, DLinklist


class BaseLinklistException(Exception):
    """
    The base exception for all Dlinklist exceptions.
    """

    __DEFAULT_MESSAGE = "Error: No message given."

    def __init__(self, msg=__DEFAULT_MESSAGE):
        """
        Call the standard Python Exception constructor and sets the default
Esempio n. 35
0
# Copyright 2011 The greplin-tornado-stripe Authors.
#
# 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.

"""The Greplin root package."""

import pkg_resources
pkg_resources.declare_namespace('greplin.tornado')
Esempio n. 36
0
# Copyright 2011 The greplin-tornado-sendgrid Authors.
#
# 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.

"""The Greplin root package."""

import pkg_resources
pkg_resources.declare_namespace('greplin')
Esempio n. 37
0
# Copyright (c) 2007, PediaPress GmbH
# See README.txt for additional licensing information.

import pkg_resources
pkg_resources.declare_namespace("mwlib")
Esempio n. 38
0
from __future__ import absolute_import, unicode_literals
try:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)
except ImportError:
    from pkg_resources import declare_namespace
    declare_namespace(__name__)

from wechatpy.parser import parse_message  # NOQA
from wechatpy.replies import create_reply  # NOQA
from wechatpy.client import WeChatClient  # NOQA
from wechatpy.exceptions import WeChatException  # NOQA
from wechatpy.exceptions import WeChatClientException  # NOQA
from wechatpy.oauth import WeChatOAuth  # NOQA
from wechatpy.exceptions import WeChatOAuthException  # NOQA
from wechatpy.pay import WeChatPay  # NOQA
from wechatpy.exceptions import WeChatPayException  # NOQA
from wechatpy.component import WeChatComponent  # NOQA


__version__ = '1.2.11'
__author__ = 'messense'
Esempio n. 39
0
try:
    # Declare this a namespace package if pkg_resources is available.
    import pkg_resources
    pkg_resources.declare_namespace('z3c')
except ImportError:
    pass