コード例 #1
0
ファイル: release.py プロジェクト: JulianSobott/pyprofiling
def release():
    args = get_args()
    shutil.rmtree("dist/", ignore_errors=True)
    subprocess.run(
        "python -m pip install --upgrade setuptools wheel".split(" "))
    sys.argv = ["setup.py", "sdist", "bdist_wheel"]
    if args["version"]:
        setup.main(args["version"])
    else:
        setup.main()

    if not args["local"]:
        subprocess.run("python -m pip install --upgrade twine".split(" "))
        if args["test"]:
            subprocess.run(
                "twine upload --repository-url https://test.pypi.org/legacy/ dist/*"
                .split(" "))
            print(
                f"Project published on: https://test.pypi.org/project/{args['name']}/"
            )
        else:
            subprocess.run("twine upload dist/*".split(" "))
            print(
                f"Project published on: https://pypi.org/project/{args['name']}/"
            )
コード例 #2
0
    def __init__(self):
        home = os.curdir
        if 'HOME' in os.environ:
            home = os.environ['HOME']
        elif os.name == 'posix':
            home = os.path.expanduser("~/")
        elif os.name == 'nt':
            if 'HOMEPATH' in os.environ and 'HOMEDRIVE' in os.environ:
                home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
        else:
            home = os.environ['HOMEPATH']

        if os.path.isfile(
                home + "/.config/unread-mail-indicator/config.ini") == False:
            setup.main()

        self.Config = ConfigParser.ConfigParser()
        self.Config.read(home + "/.config/unread-mail-indicator/config.ini")
        print self.Config.sections()

        self.ind = appindicator.Indicator(
            "Unread-Mail-Notify", "indicator-messages",
            appindicator.CATEGORY_APPLICATION_STATUS)
        self.callback_minutes = int(
            self.Config.get('Basics', 'CheckIntervalMinutes'))
        self.strNoUnreadMails = self.Config.get('Strings', 'strNoUnreadMails')
        self.strUnreadMails = self.Config.get('Strings', 'strUnreadMails')
        self.notificationEnabled = self.Config.get('Basics',
                                                   'ShowNotifications')
        self.notificationTitle = self.Config.get('Strings',
                                                 'notificationTitle')
        self.notificationIcon = 'indicator-messages-new'
        self.actionOnClick = "thunderbird"
        self.set_menu()
        glib.timeout_add_seconds(int(60) * self.callback_minutes, self.work)
コード例 #3
0
def test_main():
    make_in_main = ["fotos.xlsx", "small"]
    loc = "/home/tako/testroom/excel_fotos/fotos"
    clean_up(loc, make_in_main)

    setup.main(pathname=loc, excelfile=os.path.join(loc, "fotos.xlsx"))
    check_made(loc, make_in_main)
コード例 #4
0
    def __init__(self):
        home = os.curdir                       
        if 'HOME' in os.environ:
            home = os.environ['HOME']
        elif os.name == 'posix':
            home = os.path.expanduser("~/")
        elif os.name == 'nt':
            if 'HOMEPATH' in os.environ and 'HOMEDRIVE' in os.environ:
                home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
        else:
            home = os.environ['HOMEPATH']

        if os.path.isfile(home+"/.config/unread-mail-indicator/config.ini")==False:
            setup.main()
            
        self.Config = ConfigParser.ConfigParser()
        self.Config.read(home+"/.config/unread-mail-indicator/config.ini")
        print self.Config.sections()

        self.ind = appindicator.Indicator("Unread-Mail-Notify", "indicator-messages", appindicator.CATEGORY_APPLICATION_STATUS)
        self.callback_minutes = int(self.Config.get('Basics', 'CheckIntervalMinutes'))
        self.strNoUnreadMails = self.Config.get('Strings', 'strNoUnreadMails')
        self.strUnreadMails = self.Config.get('Strings', 'strUnreadMails')
        self.notificationEnabled = self.Config.get('Basics', 'ShowNotifications')
        self.notificationTitle = self.Config.get('Strings', 'notificationTitle')
        self.notificationIcon = 'indicator-messages-new'
        self.actionOnClick = "thunderbird"
        self.set_menu()   
        glib.timeout_add_seconds(int(60)*self.callback_minutes, self.work)
コード例 #5
0
def should_have_set_up_symlinks(monkeypatch) -> None:
    mute_logs(MODULE_NAME, monkeypatch)
    monkeypatch.setattr(f"{MODULE_NAME}.os.path.islink", lambda *a, **k: False)
    symlink_calls = []
    monkeypatch.setattr(f"{MODULE_NAME}.os.symlink",
                        lambda *a, **k: symlink_calls.append(''))
    setup.main()
    assert len(symlink_calls) == 9
コード例 #6
0
def should_not_have_set_up_symlinks_if_they_already_exist(monkeypatch) -> None:
    mute_logs(MODULE_NAME, monkeypatch)
    monkeypatch.setattr(f"{MODULE_NAME}.os.path.islink", lambda *a, **k: True)
    symlink_calls = []
    monkeypatch.setattr(f"{MODULE_NAME}.os.symlink",
                        lambda *a, **k: symlink_calls.append(''))
    setup.main()
    assert len(symlink_calls) == 0
コード例 #7
0
def main():
    setup.main()
    config = configparser.ConfigParser()
    config.read('setup.cfg')

    intro_file = config.get('paths', 'logo')
    intro(intro_file)

    journal()
コード例 #8
0
def recreate():
    ''' Recreate database with new set of subreddits'''

    # Remove database file if it exists
    if os.path.isfile('subreddits.db'):
        os.remove('subreddits.db')

    # Recreate database
    setup.main()
コード例 #9
0
def main():
    '''entry point for the command-line interface'''
    import argparse
    import __init__
    import read_config
    
    doc = __init__.__package_name__
    doc += ': ' + __init__.__description__
    
    parser = argparse.ArgumentParser(description=doc)

    if '--setup' not in sys.argv:
        parser.add_argument('xml_config_file', 
                        action='store', 
                        help="XML configuration file",
                        default='configuration.xml')

        parser.add_argument('-l', '--log_file', 
                            action='store', 
                            help="log file",
                            default='log_file.txt')
        
        parser.add_argument('-v', '--version', 
                            action='version', 
                            version=__init__.__version__)

    group = parser.add_argument_group('getting started (none of the above)')
    group.add_argument('--setup', 
                        help="setup a new project directory",
                        type=str)

    user_args = parser.parse_args()
    
    try:
        log_file = user_args.log_file
    except AttributeError:
        log_file = DEFAULT_LOG_FILE
    logging.basicConfig(filename=log_file, level=logging.INFO)
    
    if user_args.setup is not None:
        utils.logMessage('Setup requested in directory: ' + user_args.setup)
        import setup
        setup.main(user_args.setup)
        exit()

    else:
        utils.logMessage('-'*40)
        utils.logMessage('pvWebMonitor starting')
        configuration = read_config.read_xml(user_args.xml_config_file)
        utils.logMessage('read configuration file: ' + user_args.xml_config_file)
        utils.logMessage('configuration schema version: ' + configuration['SCHEMA_VERSION'])
    
        watcher = pvwatch.PvWatch(configuration)
    
        utils.logMessage('starting the monitor and report cycle')
        watcher.start()
コード例 #10
0
def check_setup(subdir):
    print('\n')
    if not os.path.exists(subdir):
        print(
            'Setup appears to not have been run, this will be done first. \n')
        try:
            setup.main()
            print('Setup completed. An empty database has been created. \n')
        except Exception as e:
            print(e)
コード例 #11
0
def main():
    # Save option
    option = int(show_menu())
    # Go through
    if option == 1:
        devmenu.main()
    elif option == 2:
        merge.main()
    elif option == 3:
        build.main()
    elif option == 4:
        setup.main()
    elif option == 5:
        quit()
コード例 #12
0
ファイル: build_bemacs.py プロジェクト: useada/BarrysEmacs
    def setupEditorMakefile(self):
        import setup

        if self.platform in ('Linux', 'MacOSX', 'NetBSD'):
            setup_targets = set([self.target, 'cli', 'unit-tests'])

        else:
            setup_targets = set(['gui', 'unit-tests'])

        if not self.opt_sqlite:
            setup_targets.add('utils')

        log.info('Creating ../Editor/Makefile-all for %s' %
                 ', '.join(sorted(setup_targets)))

        cwd = os.getcwd()
        try:
            os.chdir('../Editor')
            setup_argv = [
                sys.argv[0], self.platform, ','.join(setup_targets),
                'Makefile-all',
                '--lib-dir=%s' % (self.INSTALL_BEMACS_LIB_DIR, )
            ]
            setup_argv += self.opt_editor_setup_opt
            if setup.main(setup_argv) != 0:
                raise BuildError('Editor/setup.py failed')

        finally:
            os.chdir(cwd)
コード例 #13
0
def setup_project_dir(path):
    '''(re)creates a project scratch directory'''
    path = os.path.abspath(path)

    # tear down any old directories
    if os.path.exists(path):
        for fname in os.listdir(path):
            os.remove(os.path.join(path, fname))
        os.rmdir(path)
        time.sleep(0.1)

    # tear down any old directories
    if not os.path.exists(path):
        os.mkdir(path)

    # fill it with the default files
    setup.main(path)
コード例 #14
0
ファイル: app.py プロジェクト: robgoyal/reddit2Text
def main():

    # Create database if file doesn't exist
    if not (os.path.isfile('subreddits.db')):
        setup.main()

    # Open connection to database
    conn = sqlite3.connect('subreddits.db')
    c = conn.cursor()

    # Retrieve subreddits from database
    rows = list(c.execute("SELECT * FROM news"))

    # Close connection
    conn.close()

    # Grab posts for each subreddit
    posts = get_posts(rows)

    # Create text for posts
    print(compose_message(posts))
コード例 #15
0
def create_dist():
    if os.path.exists(tmpdir):
        shutil.rmtree(tmpdir)
    if os.path.exists('build'):
        shutil.rmtree('build')
    if os.path.exists('dist'):
        shutil.rmtree('dist')
    os.mkdir(tmpdir)

    sys.argv = ['setup.py', 'sdist', '--dist-dir=.', '--format=gztar']
    setup.main()
    shutil.move("%s-%s.tar.gz" % (setup.pkgname, setup.version), tmpdir)

    sys.argv = ['setup.py', 'bdist_egg', '--dist-dir=.']
    setup.main()
    shutil.move(
        "%s-%s-py%s.egg" %
        (setup.pkgname, setup.version, "%d.%d" % sys.version_info[0:2]),
        tmpdir)

    sys.argv = ['setup.py', 'py2exe']
    setup.main()
    os.system('"%(nsisexe)s" nsis\\pydirstat.nsi' % scriptargs)
    shutil.move(os.path.join("nsis", "pyDirStat-%s.exe" % setup.version),
                tmpdir)

    if os.path.exists('build'):
        shutil.rmtree('build')
    if os.path.exists('dist'):
        shutil.rmtree('dist')
コード例 #16
0
def create_dist():
    if os.path.exists(tmpdir):
        shutil.rmtree(tmpdir)
    if os.path.exists('build'):
        shutil.rmtree('build')
    if os.path.exists('dist'):
        shutil.rmtree('dist')
    os.mkdir(tmpdir)

    sys.argv=['setup.py','sdist','--dist-dir=.','--format=gztar']
    setup.main()
    shutil.move("%s-%s.tar.gz"%(setup.pkgname,setup.version),tmpdir)

    sys.argv=['setup.py','bdist_egg','--dist-dir=.']
    setup.main()
    shutil.move("%s-%s-py%s.egg"%(setup.pkgname,setup.version,"%d.%d"%sys.version_info[0:2]),tmpdir)

    sys.argv=['setup.py','py2exe']
    setup.main()
    os.system('"%(nsisexe)s" nsis\\pydirstat.nsi' % scriptargs)
    shutil.move(os.path.join("nsis","pyDirStat-%s.exe"%setup.version),tmpdir)


    if os.path.exists('build'):
        shutil.rmtree('build')
    if os.path.exists('dist'):
        shutil.rmtree('dist')
コード例 #17
0
ファイル: projectdata.py プロジェクト: regebro/spiny
def get_data(path, python_version=None):
    """
    Returns data from a package directory.
    'path' should be an absolute path.
    """
    # Run the imported setup to get the metadata.
    with FakeContext(path):
        with SetupMonkey(python_version) as sm:
            try:
                import setup
                metadata = sm.get_data()

                if not metadata:
                    # This may be a module, like twisted, that only runs setup()
                    # when setup.py is called as the main script. In that case it
                    # often has a main() script to call instead. Try that.
                    try:
                        setup.main()
                    except TypeError:  # OK, so it's twisted.
                        try:
                            setup.main([])
                        except TypeError:
                            pass  # OK, not twisted, then.
                    except AttributeError:
                        pass  # No, no main.

                    metadata = sm.get_data()
                del sys.modules['setup']
            except ImportError as e:
                # Either there is no setup py, or it's broken.
                logging.exception(e)
                metadata = {}

        # No data found
        if not metadata:
            return {}

    return metadata
コード例 #18
0
ファイル: main.py プロジェクト: Nyan-uwu/MAL
def main():
    _response = setup.main()
    if _response["status"] != 200:
        raise Exception(_response["message"])

    _file = malfilereader.read(sys.argv[1])
    # print(_file)
    tokenFile = lexer.main(_file)
    # print(tokenFile)
    # for t in tokenFile.tokens:
    #     print(t)

    mem = memory.Memory()
    mem = run.run(mem, tokenFile)
    print(tokenFile.outString)
    print(mem.mem)
    print(tokenFile.labels)

    return response.create(200, "Run Successful")
コード例 #19
0
ファイル: run.py プロジェクト: pombredanne/OpTools
 def __init__(self, db='~/.optools/autopkg.sqlite3'):
     db = os.path.abspath(os.path.expanduser(db))
     if not os.path.isfile(db):
         setup.firstrun(db)
     self.conn = sqlite3.connect(db)
     self.conn.row_factory = sqlite3.Row
     self.cur = self.conn.cursor()
     self.cfg = setup.main(self.conn, self.cur)
     if self.cfg['sign']:
         _cmt_mode = self.conn.isolation_level  # autocommit
         self.conn.isolation_level = None
         self.fpr, self.gpg = setup.GPG(self.cur,
                                        homedir=self.cfg['gpg_homedir'],
                                        keyid=self.cfg['gpg_keyid'])
         self.conn.isolation_level = _cmt_mode
         # don't need this anymore; it should be duplicated or populated into self.fpr.
         del (self.cfg['gpg_keyid'])
         self.my_key = self.gpg.get_key(self.fpr, secret=True)
         self.gpg.signers = [self.my_key]
     else:
         self.fpr = self.gpg = self.my_key = None
         del (self.cfg['gpg_keyid'])
     self.pkgs = {}
     self._populatePkgs()
コード例 #20
0
def _get_extensions(root, pybuilddir):
  # Enter a "setup.py" expected library pathing, and tell distutil we want to
  # build extensions.
  with \
      _temp_sys_path(root, pybuilddir), \
      _temp_sys_builtins(), \
      _temp_sys_argv(['python', 'build_ext']):

    import distutils
    import distutils.core
    import distutils.command.build_ext

    # Tells distutils main() function to stop after parsing the command line,
    # but before actually trying to build stuff.
    distutils.core._setup_stop_after = "commandline"

    # Causes the actual 'build stuff' part to be a small explosion.
    class StopBeforeBuilding(Exception):
      pass
    def PreventBuild(*_):
      raise StopBeforeBuilding('boom')
    distutils.command.build_ext.build_ext.build_extensions = PreventBuild
    distutils.command.build_ext.build_ext.build_extension = PreventBuild

    # Have cpython's setup function actually invoke distutils to do
    # everything.
    import setup
    setup.main()

    # We stopped before running any commands. We then pull the 'build_ext'
    # command out of the distribution (which core nicely caches for us at
    # distutils.core), and then finish finalizing it and then 'run' it.
    ext_builder = (
        distutils.core._setup_distribution.get_command_obj('build_ext'))
    ext_builder.ensure_finalized()

    # This does a bunch of additional setup (like setting Command.compiler), and
    # then ultimately invokes setup.PyBuildExt.build_extensions(). This function
    # analyzes the current Modules/Setup.local, and then saves an Extension for
    # every module which should be dynamically built.
    #
    # It then calls through to the base `build_extensions` function, which we
    # earlier stubbed to raise an exception, and then finally prints some
    # summary information to stdout. Since we don't care to see the extra info
    # on # stdout, we catch the exception, then look at the .extensions member.
    try:
      ext_builder.run()
    except StopBeforeBuilding:
      pass

    # Finally, we get all the extensions which should be built for this
    # platform!
    for ext in ext_builder.extensions:
      assert isinstance(ext, distutils.extension.Extension)
      # some extensions are special and doesn't get fully configured until it's
      # actually built. *sigh*
      try:
        ext_builder.build_extension(ext)
      except StopBeforeBuilding:
        pass
  return ext_builder.extensions
コード例 #21
0
from setup import main
define_macros = [('CYTHON_TRACE', 1)]
extra_directives= dict(profile=True,
                       linetrace=True,
                       binding=True)
if __name__ == '__main__':
    main(define_macros=define_macros, extra_directives=extra_directives)
コード例 #22
0
# Add bokeh folder to path
SCRAPER_BASE_PATH = str(Path(os.path.dirname(os.path.abspath(__file__))).parent) + "/"
sys.path.append(os.path.abspath(os.path.join(SCRAPER_BASE_PATH, 'viz')))

from flask import Flask, render_template
from bokeh.embed import server_document

SEASON = os.environ["FPL_SEASON"]
IP = os.environ["FPL_IP"]
BASE_PATH = str(Path(os.path.dirname(os.path.abspath(__file__))).parent)
SCRAPER_BASE_PATH = BASE_PATH + "/scraper/"
BOKEH_BASE_PATH = BASE_PATH + "/viz/"


app = Flask(__name__)
# Index page, no args
@app.route('/')
def index():
    vpc = server_document("http://" + IP + ":5006/vpc")
    aggregate = server_document("http://" + IP + ":5006/aggregate")
    return render_template("index.html", vpc=vpc, aggregate=aggregate)


# With debug=True, Flask server will auto-reload
# when there are code changes
if __name__ == '__main__':
    if len(sys.argv) < 2 or sys.argv[1] != "--skip-init":
        setup.main()
    app.run(host='0.0.0.0')

コード例 #23
0
def back_press():
    root.destroy()
    setup.main()
コード例 #24
0
# string fields after above two non-considering fields
DataNumber = 0
matchedApp = None
applications = ["notify-send", "Brave", "Firefox", "firefox"]
constructData = []
notify2.init("AutoReplyToLP")

while True:
    try:
        NotifyData = sys.stdin.readline().strip().split("\n")
        if len(NotifyData[0]) <= 1:
            pass
        else:
            if EditString(NotifyData) in applications:
                matchedApp = EditString(NotifyData)
                DataNumber = 0

            # print(NotifyData, DataNumber)
            if matchedApp in applications:
                if DataNumber == 2:
                    constructData = [EditString(NotifyData)]
                if DataNumber == 3 and "linkin park" in constructData[0].lower(
                ):
                    countdownTimer(800000)  # timer
                    main()  # launching main program

                DataNumber += 1
    except KeyboardInterrupt as e:
        break
        logging.error("shutting down coz of interrupt")
コード例 #25
0
ファイル: install.py プロジェクト: vanzinvestor/wikifeat
wikifeat_home = input("Enter the Wikifeat installation directory(" + wf_home_default + "): ")
if wikifeat_home == "":
    wikifeat_home = wf_home_default

if couchdb_server == "":
    couchdb_server = "localhost"
if couchdb_port == "":
    couchdb_port = "5984"

domain_name = input("Now, enter the domain/host name for your Wikifeat installation (localhost): ")
if domain_name == "":
    domain_name = "localhost"


main_db = "wikifeat_main_db"
avatar_db = "user_avatars"
couch_params = util.CouchParameters()
couch_params.host = couchdb_server
couch_params.port = couchdb_port
couch_params.adminuser = couchdb_admin
couch_params.adminpass = couchdb_admin_pass

master_params = util.MasterUserParameters()

print("Running database setup...")
setup.main(couch_params, main_db, avatar_db, master_params, wikifeat_home)
print("")
print("Configuring Wikifeat...")
config.main(domain_name, couch_params, wikifeat_home)

コード例 #26
0
#!/usr/bin/env python
'''
| Filename    : setup_matrix_multiply_inplace.py
| Description :
| Author      : Pushpendre Rastogi
| Created     :
| Last-Updated:
|           By: Pushpendre Rastogi
|     Update #: 0
'''
from setup import main
main(extension_ns=(("matrix_multiply_inplace",
                    ("matrix_multiply_inplace.pyx", )), ))
コード例 #27
0
import sys
import setup

setup.main(['install', '--user'])

try:
  import winreg
except ImportError:  
  import _winreg as winreg

SZ = winreg.REG_SZ
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\Classes\.ipynb") as k:
    winreg.SetValue(k, "", SZ, "Jupyter.nbopen")
    winreg.SetValueEx(k, "Content Type", 0, SZ, "application/x-ipynb+json")
    winreg.SetValueEx(k, "PerceivedType", 0, SZ, "document")
    with winreg.CreateKey(k, "OpenWithProgIds") as openwith:
        winreg.SetValueEx(openwith, "Jupyter.nbopen", 0, winreg.REG_NONE, b'')

executable = sys.executable
if executable.endswith("python.exe"):
    executable = executable[:-10] + 'pythonw.exe'
launch_cmd = '"{}" -m nbopen "%1"'.format(executable)

with winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\Classes\Jupyter.nbopen") as k:
    winreg.SetValue(k, "", SZ, "IPython notebook")
    with winreg.CreateKey(k, "shell\open\command") as launchk:
        winreg.SetValue(launchk, "", SZ, launch_cmd)

try:
    from win32com.shell import shell, shellcon
    shell.SHChangeNotify(shellcon.SHCNE_ASSOCCHANGED, shellcon.SHCNF_IDLIST, None, None)
コード例 #28
0
def test_setup():
    main(settings)
    assert os.path.isfile(settings.DATABASE) == True
コード例 #29
0
def main():
  '''main setup scripts.'''
  setup.main()
コード例 #30
0
#!/usr/bin/env python
'''
| Filename    : setup_xml2cscformat.py
| Description :
| Author      : Pushpendre Rastogi
| Created     : Sat Dec 24 04:45:42 2016 (-0500)
| Last-Updated: Sat Dec 24 18:55:07 2016 (-0500)
|           By: Pushpendre Rastogi
|     Update #: 2
'''
from setup import main
main(extension_ns=(("xml2cscformat", ("xml2cscformat.pyx", )),
                   ("analyzer", ("analyzer.pyx", "KrovetzStemmer.cpp")),
                   ("fielded_hit_list", ("fielded_hit_list.pyx", ))))
コード例 #31
0
def main():
  setup.main('13', "care_package", True)
コード例 #32
0
ファイル: bot.py プロジェクト: SoraSkyy/muse-bot
import ircmodule
import statemanager
import setup


'''
###android file paths###
dpl = '/storage/emulated/0/com.hipipal.qpyplus/scripts3/muse-bot/data.pickle'
lpl = '/storage/emulated/0/com.hipipal.qpyplus/scripts3/muse-bot/logs.pickle'
tpl = '/storage/emulated/0/com.hipipal.qpyplus/scripts3/muse-bot/twitter.pickle'
'''
dpl = 'data.pickle'
lpl = 'logs.pickle'
tpl = 'twitter.pickle'
annpl = 'ann.pickle'
ndapl = 'nda.pickle'

config = setup.main()


irc = ircmodule.IRC(config)
irc.start()
sm = statemanager.StateManager(config,irc,dpl,lpl,tpl,annpl,ndapl)    #putting irc object in to support the use of the irc.send() function in threads
while True:
    content = irc.inputs.get()
    irc.send(sm.main(content))
コード例 #33
0
# -*- coding: utf-8 -*-
# Copyright: 2018, Diez B. Roggisch, Berlin . All rights reserved.

from setup import main

try:
    main()
except KeyboardInterrupt:
    import newjoy
    newjoy.deinit()
コード例 #34
0
def database_exists():
    ''' Create database if it doesn't exist '''

    if not (os.path.isfile('subreddits.db')):
        setup.main()
コード例 #35
0
    if config.update:
        print('Updating event data...')
        update_artist_history(session, artist_history_insert)
        print('Event data up to date.')
    
    # query artist history
    process_artist_history(session=session,
                           query=query,
                           user_id=config.user_id,
                           session_id=config.session_id)

    
    
    
if __name__=="__main__":
    parser = ArgumentParser()
    parser.add_argument('--path', type=str, default=None)
    parser.add_argument('--session', default='local', type=str)
    parser.add_argument('--keyspace', default='sparkify', type=str)
    parser.add_argument('--update', action='store_true')
    parser.add_argument('--create_keyspace', action='store_true')
    parser.add_argument('--user_id', default=10, type=int)
    parser.add_argument('--session_id', default=182, type=int)
    
    config = parser.parse_args()
    cluster, session = setup.main(config)
    main(config, session)
    
    cluster.shutdown()
    session.shutdown()
コード例 #36
0
ファイル: install.py プロジェクト: shawnps/wikifeat
if couchdb_admin_pass == "":
    print("You must specify a CouchDB admin password!")
    sys.exit(-1)

if couchdb_server == "":
    couchdb_server = "localhost"
if couchdb_port == "":
    couchdb_port = "5984"

domain_name = input("Now, enter the domain/host name for your Wikifeat installation (localhost): ")
if domain_name == "":
    domain_name = "localhost"


main_db = "wikifeat_main_db"
avatar_db = "user_avatars"
couch_params = util.CouchParameters()
couch_params.host = couchdb_server
couch_params.port = couchdb_port
couch_params.adminuser = couchdb_admin
couch_params.adminpass = couchdb_admin_pass

master_params = util.MasterUserParameters()

print("Running database setup...")
setup.main(couch_params, main_db, avatar_db, master_params)
print("")
print("Configuring Wikifeat...")
config.main(domain_name, couch_params)