Beispiel #1
0
    def check_evoque_qpy():
        try:
            import evoque
        except ImportError:
            prompt='Goliat uses evoque as template engine.\n\n'+\
            'Would you like to install evoque now?'
            if userquery(prompt)=="Yes":

                currdir=os.getcwd()
                os.chdir('evoque-0.4')
                from subprocess import Popen, PIPE
                p=Popen('python2.6 setup.py {0}'.format(args[0]).split(' '), stdout=PIPE, stderr=PIPE)
                print '\n{0}ing Goliat Evoque\n'.format(args[0].capitalize())
                ret=p.communicate()
                if len(ret[1]):
                    print ret[1]
                    print '\nQuitting.'
                    sys.exit(1)
                print ret[0]
                print '\nContinue.\n'
                os.chdir(currdir)
                #from setuptools.command.easy_install import main
                #main(['evoque'])
                #print '\nContinue.\n'
        try:
            import qpy
        except ImportError:
            prompt='Goliat uses qpy with evoque.\n\n'+\
            'Would you like to install qpy now?'
            if userquery(prompt)=="Yes":
                from setuptools.command.easy_install import main
                main(['qpy'])
                print '\nContinue.\n'
Beispiel #2
0
def DoEasyUninstall(name):
    """
    Execute the easy_install command to unlink the given egg.
    What this is really doing is switching the egg to be in
    multiple-version mode, however this is the first step in deleting
    an egg as described here:
    http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages
    """
    from setuptools.command import easy_install
    args = ['--site-dirs', zenPath('ZenPacks'),
        '-d', zenPath('ZenPacks'),
        #'--record', tempPath,
        '--quiet',
        '-m',
        name]

    #Try to run the easy install command.  If this fails with an attribute
    #error, then we know that easy_install doesn't know about this ZenPack and
    #we can continue normally

    try:
        easy_install.main(args)
    except AttributeError:
        log.info("%s not found by easy_install.  Continuing to remove." % name)
        pass
Beispiel #3
0
def win_install_deps(options):
    """
    Install all Windows Binary automatically
    This can be removed as wheels become available for these packages
    """
    download_dir = path('downloaded').abspath()
    if not download_dir.exists():
        download_dir.makedirs()
    win_packages = {
        #required by transifex-client
        "Py2exe": "http://superb-dca2.dl.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe",
        "Nose": "https://s3.amazonaws.com/geonodedeps/nose-1.3.3.win32-py2.7.exe",
        #the wheel 1.9.4 installs but pycsw wants 1.9.3, which fails to compile
        #when pycsw bumps their pyproj to 1.9.4 this can be removed.
        "PyProj": "https://pyproj.googlecode.com/files/pyproj-1.9.3.win32-py2.7.exe"
    }
    failed = False
    for package, url in win_packages.iteritems():
        tempfile = download_dir / os.path.basename(url)
        grab_winfiles(url, tempfile, package)
        try:
            easy_install.main([tempfile])
        except Exception, e:
            failed = True
            print "install failed with error: ", e
        os.remove(tempfile)
Beispiel #4
0
    def install_extension(self, install_url, package_name):
        """Install an extension from a remote source.

        Installs an extension from a remote URL containing the
        extension egg. Installation may fail if a malformed install_url
        or package_name is passed, which will cause an InstallExtensionError
        exception to be raised. It is also assumed that the extension is not
        already installed.
        """

        try:
            easy_install.main(["-U", install_url])

            # Update the entry points.
            dist = pkg_resources.get_distribution(package_name)
            dist.activate()
            pkg_resources.working_set.add(dist)
        except pkg_resources.DistributionNotFound:
            raise InstallExtensionError(_("Invalid package name."))
        except SystemError:
            raise InstallExtensionError(
                _('Installation failed (probably malformed URL).'))

        # Refresh the extension manager.
        self.load(True)
    def test_no_setup_cfg(self):
        # makes sure easy_install as a command (main)
        # doesn't use a setup.cfg file that is located
        # in the current working directory
        dir = tempfile.mkdtemp()
        setup_cfg = open(os.path.join(dir, "setup.cfg"), "w")
        setup_cfg.write("[easy_install]\nfind_links = http://example.com")
        setup_cfg.close()
        setup_py = open(os.path.join(dir, "setup.py"), "w")
        setup_py.write(SETUP_PY)
        setup_py.close()

        from setuptools.dist import Distribution

        def _parse_command_line(self):
            msg = "Error: a local setup.cfg was used"
            opts = self.command_options
            if "easy_install" in opts:
                assert "find_links" not in opts["easy_install"], msg
            return self._old_parse_command_line()

        Distribution._old_parse_command_line = Distribution.parse_command_line
        Distribution.parse_command_line = _parse_command_line

        old_wd = os.getcwd()
        try:
            os.chdir(dir)
            main([])
        finally:
            os.chdir(old_wd)
            shutil.rmtree(dir)
            Distribution.parse_command_line = Distribution._old_parse_command_line
Beispiel #6
0
def win_install_deps(options):
    """
    Install all Windows Binary automatically
    """
    download_dir = path('downloaded').abspath()
    if not download_dir.exists():
        download_dir.makedirs()
    win_packages = {
        "PIL": "https://pypi.python.org/packages/2.7/P/Pillow/Pillow-2.5.1.win32-py2.7.exe",
        "Py2exe": "http://superb-dca2.dl.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe",
        "Nose": "https://s3.amazonaws.com/geonodedeps/nose-1.3.3.win32-py2.7.exe",
        "LXML": "https://pypi.python.org/packages/2.7/l/lxml/lxml-3.3.5.win32-py2.7.exe",
        "GDAL": "https://s3.amazonaws.com/geonodedeps/GDAL-1.11.0.win32-py2.7.exe",
        "PyProj": "https://pyproj.googlecode.com/files/pyproj-1.9.3.win32-py2.7.exe",
        "Shapely": "https://pypi.python.org/packages/2.7/S/Shapely/Shapely-1.3.0.win32-py2.7.exe",
        "Psycopg2": "http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.4.5.win32-py2.7-pg9.1.3-release.exe"
    }

    for package, url in win_packages.iteritems():
        tempfile = download_dir / os.path.basename(url)
        grab_winfiles(url, tempfile, package)
        try:
            easy_install.main([tempfile])
        except:
            print "install failed"
        os.remove(tempfile)
    print "Windows dependencies now complete.  Run pip install -e geonode --use-mirrors"
Beispiel #7
0
def win_install_deps(options):
    """
    Install all Windows Binary automatically
    This can be removed as wheels become available for these packages
    """
    download_dir = path('downloaded').abspath()
    if not download_dir.exists():
        download_dir.makedirs()
    win_packages = {
        # required by transifex-client
        "Py2exe": dev_config['WINDOWS']['py2exe'],
        "Nose": dev_config['WINDOWS']['nose'],
        # the wheel 1.9.4 installs but pycsw wants 1.9.3, which fails to compile
        # when pycsw bumps their pyproj to 1.9.4 this can be removed.
        "PyProj": dev_config['WINDOWS']['pyproj'],
        "lXML": dev_config['WINDOWS']['lxml']
    }
    failed = False
    for package, url in win_packages.iteritems():
        tempfile = download_dir / os.path.basename(url)
        print "Installing file ... " + tempfile
        grab_winfiles(url, tempfile, package)
        try:
            easy_install.main([tempfile])
        except Exception, e:
            failed = True
            print "install failed with error: ", e
        os.remove(tempfile)
Beispiel #8
0
def win_install_deps(options):
    """
    Install all Windows Binary automatically
    This can be removed as wheels become available for these packages
    """
    download_dir = path('downloaded').abspath()
    if not download_dir.exists():
        download_dir.makedirs()
    win_packages = {
        # required by transifex-client
        "Py2exe": dev_config['WINDOWS']['py2exe'],
        "Nose": dev_config['WINDOWS']['nose'],
        # the wheel 1.9.4 installs but pycsw wants 1.9.3, which fails to compile
        # when pycsw bumps their pyproj to 1.9.4 this can be removed.
        "PyProj": dev_config['WINDOWS']['pyproj'],
        "lXML": dev_config['WINDOWS']['lxml']
    }
    failed = False
    for package, url in win_packages.iteritems():
        tempfile = download_dir / os.path.basename(url)
        print "Installing file ... " + tempfile
        grab_winfiles(url, tempfile, package)
        try:
            easy_install.main([tempfile])
        except Exception as e:
            failed = True
            print "install failed with error: ", e
        os.remove(tempfile)
    if failed and sys.maxsize > 2**32:
        print "64bit architecture is not currently supported"
        print "try finding the 64 binaries for py2exe, nose, and pyproj"
    elif failed:
        print "install failed for py2exe, nose, and/or pyproj"
    else:
        print "Windows dependencies now complete.  Run pip install -e geonode --use-mirrors"
Beispiel #9
0
def install(name):
    sys.stdout = sys.stderr = ei_stdout = StringIO()
    try:
        easy_install.main(["--install-dir", packages_dir,
                           "--exclude-scripts",
                           name])
    except SystemExit as e:
        output = ei_stdout.getvalue()
        tb = StringIO()
        traceback.print_exc(8, tb)
        return {
            "success": False,
            "error": unicode(e),
            "traceback": tb.getvalue(),
            "output": output,
        }
    finally:
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__

    for name in os.listdir(packages_dir):
        path = os.path.join(packages_dir, name)
        if path not in sys.path:
            sys.path.insert(0, path)

    return {
        "success": True,
        "output": ei_stdout.getvalue(),
    }
Beispiel #10
0
def easyInstall(package):  
  """
  Generic method to install a package using the easy_install module, only if
  required.
  """
  sys.stdout.write('\nSearching for installed %s ... ' % package)
  sys.stdout.flush()
  notFound = False
  try:
    __import__(package)
    sys.stdout.write('[FOUND]')
  except ImportError:
    sys.stdout.write('[NOT FOUND]')
    notFound = True
    
  if notFound:
    sys.stdout.write('\nInstalling %s:\n' % package)
    try:
      easy_install.main( ["-U", package] )
      sys.stdout.write('[OK]\n')
    except:
      print "\nUnexpected error when trying to easy_install %s:\n" % (package), sys.exc_info()[0], sys.exc_info()[1]
      raise
      
  sys.stdout.flush()
def FetchZenPack(dmd, zenPackName):
    """
    Use easy_install to retrieve the given zenpack and any dependencies.
    easy_install will install the eggs, but does not install them into
    Zenoss as ZenPacks.
    Return a list of distributions just installed that appear to be
    ZenPacks.

    NB: This should be refactored.  It shares most of its code with
    DoEasyInstall()
    """
    from setuptools.command import easy_install

    # Make sure $ZENHOME/ZenPacks exists
    CreateZenPacksDir()

    # Create the proper package index URL.
    index_url = "%s/%s/%s/" % (ZENPACKS_BASE_URL, dmd.uuid, ZVersion.VERSION)

    # Create temp file for easy_install to write results to
    _, tempPath = tempfile.mkstemp(prefix="zenpackcmd-easyinstall")
    # eggPaths is a set of paths to eggs that were installed.  We need to
    # add them to the current workingset so we can discover their
    # entry points.
    eggPaths = set()
    try:
        # Execute the easy_install
        args = [
            "--site-dirs",
            zenPath("ZenPacks"),
            "-d",
            zenPath("ZenPacks"),
            "-i",
            index_url,
            "--allow-hosts",
            urlparse(index_url).hostname,
            "--record",
            tempPath,
            "--quiet",
            zenPackName,
        ]
        easy_install.main(args)
        # Collect the paths for eggs that were installed
        f = open(tempPath, "r")
        marker = ".egg/"
        markerOffset = len(marker) - 1
        for l in f.readlines():
            i = l.find(marker)
            if i > 0:
                eggPaths.add(l[: i + markerOffset])
    finally:
        os.remove(tempPath)
    # Add any installed eggs to the current working set
    zpDists = []
    for path in eggPaths:
        zpDists += AddDistToWorkingSet(path)
    return zpDists
Beispiel #12
0
    def run(self):

        # Workaround for problem in six that prevents installation when part of
        # of some package requirements
        _easy_install.main(['-U', 'six'])
        _install.run(self)
        self.execute(
            _post_install, (self.install_lib,),
            msg="\nRunning post install tasks...")
Beispiel #13
0
 def installModule(self, module):
     try:
         easy_install.main([module])
     except:
         print colored('''[%s] [-] Error installing %s module. Possibly setuptools module is not installed.
         Please visit https://pypi.python.org/pypi/setuptools to download setuptools, and try again.
         Exiting...''' % (time.strftime('%H:%M:%S'), module), 'red')
         exit()
     else:
         print colored('[%s] [+] %s module has been sucessfully installed' %(time.strftime('%H:%M:%S'), module), 'green')
Beispiel #14
0
def install_with_easyinstall(package):
    try:
        __import__(package)
        in_system.append(package)
    except ImportError:
        print 'Installing ' + package + '...'
        try:
            easy_install.main(['-U', package])
            installed.append(package)
        except Exception:
            problematic.append(package)
def easy(eas=easy_pack):
    color="BLUE"
    message = forma.line("Install i moduli di Python: ")
    print (colorstr(message, color))
    for i in eas:
        temp_message= "Installazione di "+i+" in corso: "
        message = forma.line(temp_message)
        print (colorstr(message, color))
        easy_install.main(["-U", i])
    message = forma.line("moduuli installati correttamente!!")
    print (colorstr(message, color))
Beispiel #16
0
    def run(self):
        develop.develop.run(self)

        # create symlink to legacy MaKaC dir
        # this is so that the ".egg-link" created by the "develop" command works
        if sys.platform in ["linux2", "darwin"] and not os.path.exists('MaKaC'):
            os.symlink('indico/MaKaC', 'MaKaC')

        # install dev dependencies
        env = pkg_resources.Environment()
        easy_install.main(read_requirements_file(os.path.join(os.path.dirname(__file__), 'requirements.dev.txt')))
        env.scan()
 def find_module(self, fullname, path=None):
     if fullname in self.domain_modules:
         return self
     if fullname in self.tried_modules:
         return None
     else:
         self.tried_modules.add(fullname)
         try:
             main([fullname])
             return self
         except:
             return None
Beispiel #18
0
def install_dependencies():
    from setuptools.command import easy_install
    import pkg_resources
    easy_install.main( ['setuptools',
        'sqlalchemy',
        'alembic',
        'tornado >= 3.1',
        'simplejson >= 1.9.2',
        'WTForms >= 2.0',
        'WTForms-Components',
        'pillow'
    ])
Beispiel #19
0
    def run(self):
        dirs = ["~", ".local", "share", "kupfer", "plugins"]
        install_path = path.expanduser(path.join(*dirs))
        print("mkdir {}".format(install_path))
        call("mkdir -p {}".format(install_path), shell=True)

        plugin_file = path.join(plugin_path, plugin_module + '.py')
        print("Copy {} to {}".format(plugin_file, install_path))
        call("cp -p {} {}".format(plugin_file, install_path), shell=True)
        
        print("Install dependency")
        easy_install.main(['--user', 'pip'] )
Beispiel #20
0
    def run(self):
        develop.develop.run(self)

        # create symlink to legacy MaKaC dir
        # this is so that the ".egg-link" created by the "develop" command works
        if sys.platform in ["linux2", "darwin"] and not os.path.exists('MaKaC'):
            os.symlink('indico/MaKaC', 'MaKaC')

        # install dev dependencies
        env = pkg_resources.Environment()
        easy_install.main(DEVELOP_REQUIRES)
        env.scan()
Beispiel #21
0
def install_dependencies():
    from setuptools.command import easy_install
    easy_install.main( ['setuptools',
                          'django == 1.4',
                          'django-tastypie == 0.9.11',
                          'django-tables2',
                          'simplejson >= 1.9.2',
                          'httplib2 >= 0.6.0',
                          'Distutils2',
                          'CherryPy >= 3.2.2',
                          'south',
                          'manifesto',
                          'requests'])
Beispiel #22
0
def test():
    print('Running UBC Sailbot Control Tests')
    nose_installed = True
    try: 
        import nose
    except ImportError: 
        easy_install.main(['nose'])
        nose_installed = False
    if (nose_installed):
        suite_1 = nose.loader.TestLoader().loadTestsFromName(TEST_PACKAGE)
        nose.run(suite=suite_1)
    else:
        print("\n Installed missing dependencies.  Rerun test script \n")
Beispiel #23
0
def tryLibrary(importname, textname, url):
    try:
        exec('import ' + importname)
        print "[OK]   ",textname,"library present.\n"
    except:
        print "[!!]   Unable to open the",textname,"library."
        print "[!!]   Trying to use easy_install to install it now..."
        try:
            easy_install.main( ["-U",importname] )
            print "[OK]   ",textname,"library installed.\n"
        except:
            print "[!!]   Could not install ",textname,"library with easy_install."
            print "[!!]   Library available at:"
            print "        ",url
def install_pkg(name):
    """ Install package with alea_install """

    from pkg_resources import require
    require('openalea.deploy')
    from openalea.deploy.alea_install import main

    try:
        print 'Installing ' + name
        main(['-f', ALEA_PI_URL, name])
        print '%s installed' % name
    except:
        print "Cannot install %s. Do you have root permission ?" % name
        print "Add sudo before your python command, or use --install-dir."
Beispiel #25
0
 def setUp(self):
     TestCase.setUp(self)
     try:
         import webtest
     except ImportError:
         import setuptools.command.easy_install as easy_install
         easy_install.main(["WebTest"])
         exit()
     self.test_app = webtest.TestApp(_wsgi_application)
     from google.appengine.ext.testbed import Testbed
     self.testbed = Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
def DoEasyInstall(eggPath):
    """
    Use easy_install to install an egg from the filesystem.
    easy_install will install the egg, but does not install it into
    Zenoss as ZenPacks.
    Returns a list of distributions that were installed that appear
    to be ZenPacks.
    """
    from setuptools.command import easy_install

    # Make sure $ZENHOME/ZenPacks exists
    CreateZenPacksDir()

    # Create temp file for easy_install to write results to
    _, tempPath = tempfile.mkstemp(prefix="zenpackcmd-easyinstall")
    # eggPaths is a set of paths to eggs that were installed.  We need to
    # add them to the current workingset so we can discover their
    # entry points.
    eggPaths = set()
    try:
        # Execute the easy_install
        args = [
            "--site-dirs",
            zenPath("ZenPacks"),
            "-d",
            zenPath("ZenPacks"),
            "--allow-hosts",
            "None",
            "--record",
            tempPath,
            "--quiet",
            eggPath,
        ]
        easy_install.main(args)
        # Collect the paths for eggs that were installed
        f = open(tempPath, "r")
        marker = ".egg/"
        markerOffset = len(marker) - 1
        for l in f.readlines():
            i = l.find(marker)
            if i > 0:
                eggPaths.add(l[: i + markerOffset])
    finally:
        os.remove(tempPath)
    # Add any installed eggs to the current working set
    zpDists = []
    for path in eggPaths:
        zpDists += AddDistToWorkingSet(path)
    return zpDists
Beispiel #27
0
def install_with_easyinstall(package):
    try:
        if package == 'PyWavelets':
            __import__('pywt')
        elif package == 'PIL':
            __import__('Image')
        else: __import__(package)
        in_system.append(package)
    except ImportError:
        print 'Installing ' + package
        try:
            easy_install.main(['-U', package])
            installed.append(package)
        except Exception:
            problematic.append(package)
Beispiel #28
0
    def run(self):
        # easy_install from urls
        install_urls = [
            "https://github.com/pyfarm/pyfarm-core/archive/master.zip",
            "https://github.com/pyfarm/pyfarm-agent/archive/master.zip",
            "https://github.com/pyfarm/pyfarm-master/archive/master.zip",
            "https://github.com/pyfarm/pyfarm-models/archive/master.zip",
            "https://github.com/pyfarm/pyfarm-jobtypes/archive/master.zip"]
        easy_install.main(install_urls)

        # regular install command
        if self.old_and_unmanageable or self.single_version_externally_managed:
            _install.run(self)
        else:
            self.do_egg_install()
Beispiel #29
0
def module_installer(package):
    """
    Install a package given via PIP or easy_install.
    :param package: str the name of the package.
    """
    global on_pip
    global on_easy_install

    print('Setting up: ' + package)
    if on_pip:
        pip.main(['install', package])  # PIP command
    elif on_easy_install:
        easy_install.main(['-U', package])  # easy_install command
    else:
        return None
Beispiel #30
0
def get_long_description():
    readme_file = 'README.md'
    if not os.path.isfile(readme_file):
        return ''
    # Try to transform the README from Markdown to reStructuredText.
    try:
        easy_install.main(['-U', 'pyandoc==0.0.1'])
        import pandoc
        pandoc.core.PANDOC_PATH = 'pandoc'
        doc = pandoc.Document()
        doc.markdown = open(readme_file).read()
        description = doc.rst
    except Exception:
        description = open(readme_file).read()
    return description
Beispiel #31
0
def install_package(pkg_name):
    import setuptools, pkg_resources, site, sysconfig
    from setuptools.command import easy_install

    if sys.platform.startswith('java'):
        from distutils.command.install import INSTALL_SCHEMES
        INSTALL_SCHEMES['java_user'] = {
            'purelib': '$usersite',
            'platlib': '$usersite',
            'headers': '$userbase/include/python$py_version_short/$dist_name',
            'scripts': '$userbase/bin',
            'data': '$userbase',
        }
        import setuptools
        from setuptools import ssl_support
        ssl_support.is_available = False

        from java.net import URL
        from java.io import BufferedInputStream
        from jarray import zeros

        org_urlopen = urllib2.urlopen

        class Headers(dict):
            def getheaders(self, key):
                value = self.get(key.lower())
                if (value == None):
                    return list()
                else:
                    return list(value)

        class ConnReader:
            def __init__(self, conn):
                self.conn = conn
                self.url = conn.getURL().toExternalForm()

                fields = self.conn.getHeaderFields()
                self.headers = Headers()
                for key in fields:
                    if key != None:
                        self.headers[key.lower()] = conn.getHeaderField(key)
                self.bs = BufferedInputStream(self.conn.getInputStream())

            def read(self, *args):
                if len(args) == 1:
                    size = args[0]
                    buf = zeros(size, 'b')
                    off = 0
                    while size > 0:
                        count = self.bs.read(buf, off, size)
                        if count == -1:
                            buf = buf[:off]
                            break
                        off += count
                        size -= count

                    return buf.tostring()
                else:
                    return self.read(int(self.headers['content-length']))

            def info(self):
                return Headers(self.headers)

            def close(self):
                self.bs.close()

        def new_urlopen(req):
            if isinstance(req, str):
                full_url = req
            else:
                full_url = req.get_full_url()
            if full_url.startswith('https'):
                u = URL(full_url)
                conn = u.openConnection()
                return ConnReader(conn)
            else:
                org_urlopen(req)

        urllib2.urlopen = new_urlopen

        old_rmtree = easy_install.rmtree

        def new_rmtree(path,
                       ignore_errors=False,
                       onerror=easy_install.auto_chmod):
            try:
                old_rmtree(path, ignore_errors, onerror)
            except:
                sys.stderr.write(
                    "Unable to remove temporary directory : %s\n" % ((path)))
                sys.stderr.flush()

        easy_install.rmtree = new_rmtree
    try:
        dist = pkg_resources.get_distribution(pkg_name)
    except:
        log.warn("Downloading package %s...", pkg_name)
        mkdir_p(site.USER_SITE)
        easy_install.main(argv=['--user', '-U', pkg_name])

        site.addsitedir(sysconfig.get_path('platlib', os.name + '_user'))
        reload(pkg_resources)

        dist = pkg_resources.get_distribution(pkg_name)
        dist.activate()
    if sys.platform.startswith('java'):
        urllib2.urlopen = org_urlopen
        easy_install.rmtree = old_rmtree
    return dist.version
Beispiel #32
0
# for installing magic IPython stuff
# In ipython run this
# %load https://raw.github.com/jkitchin/pycse/master/install-pycse.py

from setuptools.command import easy_install

easy_install.main(["-U", "pycse"])

# my customized pyreport
package = 'https://github.com/jkitchin/pyreport/archive/master.zip'
easy_install.main(["-U", package])

import IPython, os

IPydir = os.path.join(IPython.utils.path.get_ipython_dir(), 'profile_default',
                      'startup')

print 'Installing ipython magic to : ', IPydir

if not os.path.exists(IPydir):
    raise Exception('No ipython directory found')

url = 'https://raw.github.com/jkitchin/pycse/master/pycse/00-pycse-magic.py'

import urllib

urllib.urlretrieve(url, os.path.join(IPydir, '00-pycse-magic.py'))
print 'Ipython magic installed now!'

# extra packages
easy_install.main(["-U", "quantities"])
Beispiel #33
0
# -*- coding: utf-8 -*-
from setuptools.command import easy_install
import importlib
import pkg_resources

# If pip is not installed, install it
try:
    import pip
except ImportError:
    easy_install.main(['-U', 'pip'])
finally:
    pkg_resources.require('pip')
    import pip
# Install external packages
packages = ['musicbrainzngs', 'soundcloud', 'mutagen']
for package in packages:
    try:
        importlib.import_module(package)
    except ImportError:
        pip.main(['install', package])
Beispiel #34
0
                    "...Okay...I mean that's cool, I'm not mad or anything but I really\n"
                    "would have preferred for you to selected your own choice but here\n"
                    "we are.\nUmm...\nSoooo....\nI guess this one will do...Have fun..."
                )
                sleep(7)
                break

    if gselect == 'm':
        typewrite(
            "Awesome! Now lets go ahead and get a voice you like selected!")

    if gselect == 'f':
        typewrite(
            "Awesome! Now lets go ahead and get a voice you like selected!")
    # elif gselect != 'm' or 'f':
    # typewrite("Hey I also like to just press random keys, but to make sure "
    # "you get a voice you like. Please enter 'M' or 'F', and if you "
    # "don't want to press the shift key it's okay, I promise.")
    if maxAttempts == 0:
        engine = pyttsx3.init()
        rate = engine.getProperty('rate')
        engine.setProperty('rate', 300)
        volume = engine.getProperty('volume')
        engine.setProperty('volume', 0.95)
        voices = engine.getProperty('voices')
        engine.setProperty('voice', voices[0].id)
        sleep(0.4)
        questionOne()

main()
Beispiel #35
0
#
# See also: http://docs.astropy.org/en/stable/install.html#installing-astropy-into-casa
#
# but withouth the --user, so it installs for all users in the current python that casa used
#
# Note with casa6 may not be needed anymore.
#
from setuptools.command import easy_install
easy_install.main(['pip'])
import pip
pip.main(['install', 'astropy'])

Beispiel #36
0
# https://github.com/ninjaaron/fast-entry_points
# workaround for slow 'pkg_resources' import
#
# NOTE: this only has effect on console_scripts and no speed-up for commands
# under scripts/. Consider stop using scripts and use console_scripts instead
#
# https://stackoverflow.com/questions/18787036/difference-between-entry-points-console-scripts-and-scripts-in-setup-py
try:
    import fastentrypoints
except ImportError:
    from setuptools.command import easy_install
    import pkg_resources
    easy_install.main(['fastentrypoints'])
    pkg_resources.require('fastentrypoints')
    import fastentrypoints

import glob
from setuptools import setup
import unittest


def get_test_suite():
    test_loader = unittest.TestLoader()
    test_suite = test_loader.discover('sonic-utilities-tests', pattern='*.py')
    return test_suite


setup(
    name='sonic-utilities',
    version='1.2',
    description='Command-line utilities for SONiC',
Beispiel #37
0
def stage1(tmpdir, sourcepath):
    """STAGE 1: temporary install EasyBuild using distribute's easy_install."""

    info(
        "\n\n+++ STAGE 1: installing EasyBuild in temporary dir with easy_install...\n\n"
    )

    # determine locations of source tarballs, if sources path is specified
    source_tarballs = {}
    if sourcepath is not None:
        info("Fetching sources from %s..." % sourcepath)
        for pkg in EASYBUILD_PACKAGES:
            pkg_tarball_glob = os.path.join(sourcepath, '%s*.tar.gz' % pkg)
            pkg_tarball_paths = glob.glob(pkg_tarball_glob)
            if len(pkg_tarball_paths) > 1:
                error("Multiple tarballs found for %s: %s" %
                      (pkg, pkg_tarball_paths))
            elif len(pkg_tarball_paths) == 0:
                if pkg != VSC_BASE:
                    # vsc-base package is not strictly required
                    # it's only a dependency since EasyBuild v2.0;
                    # with EasyBuild v2.0, it will be pulled in from PyPI when installing easybuild-framework
                    error("Missing source tarball: %s" % pkg_tarball_glob)
            else:
                info("Found %s for %s package" % (pkg_tarball_paths[0], pkg))
                source_tarballs.update({pkg: pkg_tarball_paths[0]})

    from setuptools.command import easy_install

    # prepare install dir
    targetdir_stage1 = os.path.join(tmpdir, 'eb_stage1')
    prep(targetdir_stage1)  # set PATH, Python search path

    # install latest EasyBuild with easy_install from PyPi
    cmd = []
    cmd.append('--upgrade')  # make sure the latest version is pulled from PyPi
    cmd.append('--prefix=%s' % targetdir_stage1)

    if source_tarballs:
        # install provided source tarballs (order matters)
        cmd.extend([
            source_tarballs[pkg] for pkg in EASYBUILD_PACKAGES
            if pkg in source_tarballs
        ])
    else:
        # install meta-package easybuild from PyPI
        cmd.append('easybuild')

    if not print_debug:
        cmd.insert(0, '--quiet')
    info("installing EasyBuild with 'easy_install %s'" % (' '.join(cmd)))
    easy_install.main(cmd)

    # clear the Python search path, we only want the individual eggs dirs to be in the PYTHONPATH (see below)
    # this is needed to avoid easy-install.pth controlling what Python packages are actually used
    os.environ['PYTHONPATH'] = ''

    # template string to inject in template easyconfig
    templates = {}

    for pkg in EASYBUILD_PACKAGES:
        templates.update({pkg: ''})

        pkg_egg_dir = find_egg_dir_for(targetdir_stage1, pkg)
        if pkg_egg_dir is None:
            if pkg == VSC_BASE:
                # vsc-base is optional in older EasyBuild versions
                continue

        # prepend EasyBuild egg dirs to Python search path, so we know which EasyBuild we're using
        sys.path.insert(0, pkg_egg_dir)
        pythonpaths = [
            x for x in os.environ.get('PYTHONPATH', '').split(os.pathsep)
            if len(x) > 0
        ]
        os.environ['PYTHONPATH'] = os.pathsep.join([pkg_egg_dir] + pythonpaths)

        if source_tarballs:
            if pkg in source_tarballs:
                templates.update(
                    {pkg: "'%s'," % os.path.basename(source_tarballs[pkg])})
        else:
            # determine per-package versions based on egg dirs, to use them in easyconfig template
            version_regex = re.compile('%s-([0-9a-z.-]*)-py[0-9.]*.egg' %
                                       pkg.replace('-', '_'))
            pkg_egg_dirname = os.path.basename(pkg_egg_dir)
            res = version_regex.search(pkg_egg_dirname)
            if res is not None:
                pkg_version = res.group(1)
                debug("Found version for easybuild-%s: %s" %
                      (pkg, pkg_version))
                templates.update({pkg: "'%s-%s.tar.gz'," % (pkg, pkg_version)})
            else:
                tup = (pkg, pkg_egg_dirname, version_regex.pattern)
                error(
                    "Failed to determine version for easybuild-%s package from %s with %s"
                    % tup)

    # figure out EasyBuild version via eb command line
    # note: EasyBuild uses some magic to determine the EasyBuild version based on the versions of the individual packages
    pattern = "This is EasyBuild (?P<version>%(v)s) \(framework: %(v)s, easyblocks: %(v)s\)" % {
        'v': '[0-9.]*[a-z0-9]*'
    }
    version_re = re.compile(pattern)
    version_out_file = os.path.join(tmpdir, 'eb_version.out')
    eb_version_cmd = 'from easybuild.tools.version import this_is_easybuild; print(this_is_easybuild())'
    cmd = "python -c '%s' > %s 2>&1" % (eb_version_cmd, version_out_file)
    debug("Determining EasyBuild version using command '%s'" % cmd)
    os.system(cmd)
    txt = open(version_out_file, "r").read()
    res = version_re.search(txt)
    if res:
        eb_version = res.group(1)
        debug("installing EasyBuild v%s" % eb_version)
    else:
        error(
            "Stage 1 failed, could not determine EasyBuild version (txt: %s)."
            % txt)

    templates.update({'version': eb_version})

    # clear PYTHONPATH before we go to stage2
    # PYTHONPATH doesn't need to (and shouldn't) include the stage1 egg dirs
    os.environ['PYTHONPATH'] = ''

    # make sure we're getting the expected EasyBuild packages
    import easybuild.framework
    if tmpdir not in easybuild.framework.__file__:
        error("Found another easybuild-framework than expected: %s" %
              easybuild.framework.__file__)
    else:
        debug("Found easybuild-framework in expected path, good!")

    import easybuild.easyblocks
    if tmpdir not in easybuild.easyblocks.__file__:
        error("Found another easybuild-easyblocks than expected: %s" %
              easybuild.easyblocks.__file__)
    else:
        debug("Found easybuild-easyblocks in expected path, good!")

    debug("templates: %s" % templates)
    return templates
Beispiel #38
0
from setuptools.command import easy_install

# install python packages
easy_install.main(
    ['genshi==0.7',
     'sqlalchemy==0.7.6',
     'psycopg2==2.4.5',
     'pytz==2015.07',
     'pandas==0.13.0.dev0',
     'bcrypt==0.4',
     'markdown==2.3.1',
     'matplotlib==1.3.1',
     'configparser==3.3.0.post2',
     'xlrd==0.9.4'])

# install linux software
# TODO: add linux software dep

# TODO: SETUP.PY script

# python --
#
#   genshi
#   sqlalchemy
#   psycopg2
#   pytz
#   pandas
#   bcrypt
#   markdown
#   matplotlib
#      [ #linux software
Beispiel #39
0
# Using easy_install inside a python script?
from setuptools.command import easy_install
easy_install.main( ["-U","py2app"] )
Beispiel #40
0
import os
try:
    import shodan
except ImportError:
    try:
        print('[-] Shodan isn`t found. Try to install it...')
        from setuptools.command import easy_install

        easy_install.main(["-U", "shodan"])
        print('[+] Shodan was installed')
        import shodan
    except ImportError:
        print('[-] Oops. Something went wrong!')
        print('[-] Couldn`t install shodan')
        exit(-1)
from math import ceil
import argparse

parser = argparse.ArgumentParser(description='Console search in Shodan')
parser.add_argument('-o',
                    dest='out_file',
                    action='store',
                    help='Output file for results')
parser.add_argument('-q', dest='query', action='store', help='Search query')
parser.add_argument('-k',
                    dest='shodan_key',
                    action='store',
                    help='Shodan API key')

args = parser.parse_args()
Beispiel #41
0
if __name__ == '__main__':
    import sys
    from setuptools.command.easy_install import main

    sys.exit(main())
Beispiel #42
0
def install_with_easyinstall(package):
    """Install the specified packages (in dry-run)."""
    easy_install.main(["-U", package])
Beispiel #43
0
        sys.exit(2)
    #TGEND

    req = "setuptools>=" + version
    import pkg_resources
    try:
        pkg_resources.require(req)
    except pkg_resources.VersionConflict:
        try:
            from setuptools.command.easy_install import main
        except ImportError:
            from easy_install import main
        #TGBEGIN
        install_command()
        #TGEND
        main(list(argv)+[download_setuptools(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        from setuptools.command.easy_install import main
        #TGBEGIN
        install_command()
        #TGEND
        main(argv)

def update_md5(filenames):
    """Update our built-in md5 registry"""

    import re

    for name in filenames:
        base = os.path.basename(name)
 def install_addon(self, url, distribution):
     print "Installing", distribution, "from", url
     easy_install.main(["-U", "-f", url, distribution])
Beispiel #45
0
    data = ["    %r: %r,\n" % it for it in md5_data.items()]
    data.sort()
    repl = "".join(data)

    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()

    match = re.search("\nmd5_data = {\n([^}]+)}", src)
    if not match:
        print >>sys.stderr, "Internal error!"
        sys.exit(2)

    src = src[:match.start(1)] + repl + src[match.end(1):]
    f = open(srcfile,'w')
    f.write(src)
    f.close()


if __name__=='__main__':
    if len(sys.argv)>2 and sys.argv[1]=='--md5update':
        update_md5(sys.argv[2:])
    else:
        main(sys.argv[1:])






Beispiel #46
0
 def _installMissing(self, dist):
     env = pkg_resources.Environment()
     print dist, EXTRA_RESOURCES_URL
     easy_install.main(["-f", EXTRA_RESOURCES_URL, "-U", str(dist)])
     env.scan()
     return env[str(dist)][0]
Beispiel #47
0
# How can I install Python modules programmatically / through a Python script?
from setuptools.command import easy_install

easy_install.main(["pythonModule"])
Beispiel #48
0
def install_with_easyinstall(package):
    for key, value in package.items():
        easy_install.main([key + '==' + value])
Beispiel #49
0
def magic_easy_install(self, package):
    easy_install.main([args, package])
    def onInstallPluginsEvent(self, event):

        patterns = "%s|*.tar.gz;*.tar|%s (*.*)|*.*" % (_(u"tar archives"),
                                                       _(u"All files"))
        dlg = wx.FileDialog(None, _(u"Install Plugin"), "", "", patterns,
                            wx.OPEN)
        if dlg.ShowModal() == wx.ID_OK:
            archive = dlg.GetPath()
        else:
            archive = None
        dlg.Destroy()

        if archive is not None:
            options = Globals.options

            # find writable path on options.pluginPath
            # it is assumed that, unless the user changed the defaults,
            # that pluginPath contains at least a path relative to CHANDLERHOME
            # and another relative to the user's PROFILEDIR, in that order,
            # so that plugins are installed in a shared directory (when
            # CHANDLERHOME is shared) by default.

            for pluginsDir in options.pluginPath:
                try:
                    if not os.path.exists(pluginsDir):
                        os.makedirs(pluginsDir)
                except OSError:
                    continue
                if os.access(pluginsDir, os.W_OK):
                    break
            else:
                raise ValueError, ('no writable path in pluginPath',
                                   options.pluginPath)

            try:
                from setuptools.command.easy_install import main
                from distutils.log import _global_log
                from util.string_utils import nocase_replace

                # patch distutils' logger with logging's
                # distutils logging levels happen to be one tenth of logging's
                # Also ensure that we don't write full profileDir to log,
                # which would be a security issue.
                def log(level, msg, args):
                    if msg:
                        if wx.Platform == '__WXMSW__':
                            msg = nocase_replace(msg,
                                                 Globals.options.profileDir,
                                                 '$PROFILEDIR')
                        else:
                            msg = msg.replace(Globals.options.profileDir,
                                              '$PROFILEDIR')

                    logger.log(level * 10, msg, *args)

                _log = _global_log._log
                _global_log._log = log

                try:
                    main([
                        '--multi-version', '--install-dir', pluginsDir, archive
                    ])
                except:
                    logger.exception("Plugin installation failed")
                    # Could be a SystemExit exception, since we called a
                    # main() directly.
            finally:
                _global_log._log = _log

            env, eggs = Utility.initPluginEnv(options, options.pluginPath)
            prefs = Utility.initPlugins(options, self.itsView, env, eggs)

            # Update the menus
            self.widget.GetSubMenu().pluginPrefs = prefs.get('plugins', {})
            self.synchronizeWidget()
            self.refreshMenus(self.itsView)
Beispiel #51
0
def stage1(tmpdir):
    """STAGE 1: temporary install EasyBuild using distribute's easy_install."""

    info(
        "\n\n+++ STAGE 1: installing EasyBuild in temporary dir with easy_install...\n\n"
    )

    from setuptools.command import easy_install

    # prepare install dir
    targetdir_stage1 = os.path.join(tmpdir, 'eb_stage1')
    prep(targetdir_stage1)  # set PATH, Python search path

    # install latest EasyBuild with easy_install from PyPi
    cmd = []
    cmd.append('--upgrade')  # make sure the latest version is pulled from PyPi
    cmd.append('--prefix=%s' % targetdir_stage1)
    cmd.append('easybuild')
    if not print_debug:
        cmd.insert(0, '--quiet')
    debug("installing EasyBuild with 'easy_install %s'" % (" ".join(cmd)))
    easy_install.main(cmd)

    # clear the Python search path, we only want the individual eggs dirs to be in the PYTHONPATH (see below)
    # this is needed to avoid easy-install.pth controlling what Python packages are actually used
    os.environ['PYTHONPATH'] = ''

    versions = {}

    pkg_egg_dir_framework = None
    for pkg in ['easyconfigs', 'easyblocks', 'framework']:
        pkg_egg_dir = find_egg_dir_for(targetdir_stage1, 'easybuild-%s' % pkg)

        # prepend EasyBuild egg dirs to Python search path, so we know which EasyBuild we're using
        sys.path.insert(0, pkg_egg_dir)
        pythonpaths = [
            x for x in os.environ.get('PYTHONPATH', '').split(os.pathsep)
            if len(x) > 0
        ]
        os.environ['PYTHONPATH'] = os.pathsep.join([pkg_egg_dir] + pythonpaths)

        # determine per-package versions based on egg dirs
        version_regex = re.compile('easybuild_%s-([0-9a-z.-]*)-py[0-9.]*.egg' %
                                   pkg)
        pkg_egg_dirname = os.path.basename(pkg_egg_dir)
        res = version_regex.search(pkg_egg_dirname)
        if res is not None:
            pkg_version = res.group(1)
            versions.update({'%s_version' % pkg: pkg_version})
            debug("Found version for easybuild-%s: %s" % (pkg, pkg_version))
        else:
            error(
                "Failed to determine version for easybuild-%s package from %s with %s"
                % (pkg, pkg_egg_dirname, version_regex.pattern))

        if pkg == 'framework':
            pkg_egg_dir_framework = pkg_egg_dir

    # figure out EasyBuild version via eb command line
    # NOTE: EasyBuild uses some magic to determine the EasyBuild version based on the versions of the individual packages
    version_re = re.compile(
        "This is EasyBuild (?P<version>[0-9.]*[a-z0-9]*) \(framework: [0-9.]*[a-z0-9]*, easyblocks: [0-9.]*[a-z0-9]*\)"
    )
    version_out_file = os.path.join(tmpdir, 'eb_version.out')
    os.system("python -S %s/easybuild/main.py --version > %s 2>&1" %
              (pkg_egg_dir_framework, version_out_file))
    txt = open(version_out_file, "r").read()
    res = version_re.search(txt)
    if res:
        eb_version = res.group(1)
        debug("installing EasyBuild v%s" % eb_version)
    else:
        error(
            "Stage 1 failed, could not determine EasyBuild version (txt: %s)."
            % txt)

    versions.update({'version': eb_version})

    # clear PYTHONPATH before we go to stage2
    # PYTHONPATH doesn't need to (and shouldn't) include the stage1 egg dirs
    os.environ['PYTHONPATH'] = ''

    # make sure we're getting the expected EasyBuild packages
    import easybuild.framework
    if not tmpdir in easybuild.framework.__file__:
        error("Found another easybuild-framework than expected: %s" %
              easybuild.framework.__file__)
    else:
        debug("Found easybuild-framework in expected path, good!")

    import easybuild.easyblocks
    if not tmpdir in easybuild.easyblocks.__file__:
        error("Found another easybuild-easyblocks than expected: %s" %
              easybuild.easyblocks.__file__)
    else:
        debug("Found easybuild-easyblocks in expected path, good!")

    return versions
Beispiel #52
0
#!/usr/bin/python
from setuptools.command import easy_install
easy_install.main(["-U", "virtualenv"])
easy_install.main(["-U", "gdata"])
easy_install.main(["-U", "flask"])
easy_install.main(["-U", "pyparsing"])
easy_install.main(["-U", "google-api-python-client"])
import json
import boto3
from botocore.vendored import requests
from awsglue.utils import getResolvedOptions
import logging
import sys
import os
import site
from setuptools.command import easy_install
install_path = os.environ['GLUE_INSTALLATION']
easy_install.main([
    "--install-dir", install_path,
    "https://files.pythonhosted.org/packages/83/03/10902758730d5cc705c0d1dd47072b6216edc652bc2e63a078b58c0b32e6/pg8000-1.12.5.tar.gz"
])
reload(site)
import pg8000
from urlparse import urlparse

logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

#Required Parameters
args = getResolvedOptions(sys.argv, [
    'UserName', 'UserPassword', 'Database', 'HostName', 'Port', 'SQLScript',
    'Role'
])

user = args['UserName']
password = args['UserPassword']
database = args['Database']
Beispiel #54
0
def install_with_easyinstall(package):
    easy_install.main(["-U", package])
Beispiel #55
0
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job

# install nltk
import os
import site
from importlib import reload
from setuptools.command import easy_install
install_path = site.getsitepackages()[0]
easy_install.main( ["--install-dir", "/home/spark/.local/lib/python3.7/site-packages", "https://files.pythonhosted.org/packages/92/75/ce35194d8e3022203cca0d2f896dbb88689f9b3fce8e9f9cff942913519d/nltk-3.5.zip"] )
reload(site)

import nltk
from pyspark.sql import functions as F
from pyspark.sql.types import *
import bla as alb

## @params: [JOB_NAME]
args = getResolvedOptions(sys.argv, ['JOB_NAME'])

sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)
## @type: DataSource
Beispiel #56
0
limitations under the License.

E-mail the developers: [email protected]

"""

print "=== Harwell Automatic Recon Processor (HARP) ===\n"
print "Downloading dependencies..."

# easy_install first
try:
    from setuptools.command import easy_install
    dependencies = ["six," "numpy", "scikit-image", "pyyaml", "PIL", "SimpleITK"]

    for dep in dependencies:

        try:
            print "Installing {0}...".format(dep),
            mod = __import__(dep)  # try to import module
            print " already installed.".format(dep)

        except ImportError:
            # If it fails, try to easy install it
            easy_install.main(["--user", dep])
            print "done."

except ImportError:
    print "Couldn't locate 'easy_install'. Do you have setuptools installed on your machine? Try sudo apt-get install python-setuptools (Linux) or use Homebrew (Mac)."


Beispiel #57
0
    def run(self):
        # dependencies, links, etc...
        develop_indico.run(self)

        env = pkg_resources.Environment()
        easy_install.main(DEVELOP_REQUIRES)
        env.scan()

        local = 'etc/indico.conf'
        if os.path.exists(local):
            print 'Upgrading existing etc/indico.conf..'
            upgrade_indico_conf(local, 'etc/indico.conf.sample')
        else:
            print 'Creating new etc/indico.conf..'
            shutil.copy('etc/indico.conf.sample', local)

        for f in [
                x for x in ('etc/zdctl.conf', 'etc/zodb.conf',
                            'etc/logging.conf') if not os.path.exists(x)
        ]:
            shutil.copy('%s.sample' % f, f)

        print """\nIndico needs to store some information in the filesystem (database, cache, temporary files, logs...)
Please specify the directory where you'd like it to be placed.
(Note that putting it outside of your sourcecode tree is recommended)"""
        prefixDirDefault = os.path.dirname(os.getcwd())
        prefixDir = raw_input('[%s]: ' % prefixDirDefault).strip()

        if prefixDir == '':
            prefixDir = prefixDirDefault

        directories = dict((d, os.path.join(prefixDir, d))
                           for d in ['db', 'log', 'tmp', 'cache', 'archive'])

        print 'Creating directories...',
        for d in directories.values():
            if not os.path.exists(d):
                os.makedirs(d)
        print 'Done!'

        directories['htdocs'] = os.path.join(os.getcwd(), 'indico', 'htdocs')
        directories['bin'] = os.path.join(os.getcwd(), 'bin')
        directories['etc'] = os.path.join(os.getcwd(), 'etc')
        directories['doc'] = os.path.join(os.getcwd(), 'doc')

        self._update_conf_dir_paths(local, directories)

        # avoid modifying the htdocs folder permissions (it brings problems with git)
        directories.pop('htdocs')

        from MaKaC.consoleScripts.installBase import _databaseText, _findApacheUserGroup, _checkDirPermissions, \
            _updateDbConfigFiles, _updateMaKaCEggCache

        user = ''

        sourcePath = os.getcwd()

        # find the apache user/group
        user, group = _findApacheUserGroup(self.www_uid, self.www_gid)
        _checkDirPermissions(directories,
                             dbInstalledBySetupPy=directories['db'],
                             accessuser=user,
                             accessgroup=group)

        _updateDbConfigFiles(directories['db'], directories['log'],
                             os.path.join(sourcePath, 'etc'),
                             directories['tmp'], user)

        _updateMaKaCEggCache(
            os.path.join(os.path.dirname(__file__), 'indico', 'MaKaC',
                         '__init__.py'), directories['tmp'])

        updateIndicoConfPathInsideMaKaCConfig(
            os.path.join(os.path.dirname(__file__), ''),
            'indico/MaKaC/common/MaKaCConfig.py')
        compileAllLanguages(self)
        print '''
%s
        ''' % _databaseText('etc')
Beispiel #58
0
import sys
import time
if not hasattr(sys, 'argv'):
    sys.argv = ['']
time.sleep(5)
from setuptools.command import easy_install
#easy_install.main( ["-U","scipy==0.9.0"] )
time.sleep(3)
easy_install.main(["-U", "-v", "sources/PyGObject-3.27.1.tar.gz"])
time.sleep(5)
#easy_install.main( ["-U","pyserial==3.4"] )
Beispiel #59
0
url_address = 'http://feeds.bbci.co.uk/news/rss.xml'
max_sentence_chars = 140  #for twitter ofc

hours_to_tweet_news = [8, 12, 18,
                       22]  #time at which to tweet number_of_stories
number_of_stories = 5
gmt_offset = +1  #so that hours are valid

try:
    import twitter
except ImportError:
    try:
        print 'twitter module not found, trying to install...'
        from setuptools.command import easy_install
        easy_install.main(['-U', 'twitter'])
        import twitter
    except ImportError:
        print 'please download module from:'
        print 'http://mike.verdone.ca/twitter/#install'
        print 'easy_install not present :('


def postToTwitter(message):
    try:
        twit = twitter.Twitter(
            auth=twitter.OAuth(token, token_key, con_key, con_secret))
        if len(message) <= 140:
            try:
                twit.statuses.update(status=message)
            except twitter.TwitterHTTPError:
Beispiel #60
0
.. _Chapter 5: chapter05.html
.. _Chapter 6: chapter06.html
.. _Chapter 7: chapter07.html
.. _Chapter 8: chapter08.html
.. _Chapter 9: chapter09.html
.. _Chapter 10: chapter10.html
.. _Chapter 11: chapter11.html
.. _Chapter 12: chapter12.html
.. _Chapter 13: chapter13.html
.. _Chapter 14: chapter14.html
.. _Chapter 15: chapter15.html
.. _Chapter 16: chapter16.html
.. _Chapter 17: chapter17.html
.. _Chapter 18: chapter18.html
.. _Chapter 19: chapter19.html
.. _Chapter 20: chapter20.html
"""

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# On RTD we can't import sphinx_rtd_theme, but it will be applied by
# default anyway.  This block will use the same theme when building locally
# as on RTD.
if not on_rtd:
    try:
        import sphinx_rtd_theme
    except ImportError:
        easy_install.main(["sphinx_rtd_theme"])
    html_theme = 'sphinx_rtd_theme'
    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]