def build(self):

            self.change_to_parent_dir()
            self.init_virtualenv()
            print('created {}'.format(self.virtualenv_dir()))

            if self.virtualenv_dir_exists():
                os.chdir(self.VIRTUAL_SUBDIR)
                if IS_PY2:
                    self.link_supervisord_files()
                    print('linked supervisord')

                # activate the virtualenv
                with venv(dirname=self.virtualenv_dir()):
                    print('configuring virtualenv')

                    os.chdir('lib')
                    if IS_PY2:
                        sh.ln('-s', 'python2.7', 'python')
                    else:
                        sh.ln('-s', 'python3.4', 'python')

                    print('   installing requirements')
                    with open(self.get_requirements()) as f:
                        for line in f.readlines():
                            if len(line.strip()) > 0:
                                print('     {}'.format(line.strip()))
                                if IS_PY2:
                                    sh.pip('install', line.strip())
                                else:
                                    sh.pip3('install', line.strip())

                    print('   linking our packages')
                    os.chdir('python/site-packages')
                    self.link_packages()

                self.finish_build()

                print('Finished creating virtualenv')
            else:
                print('!!!Error: Unable to create virtualenv')
示例#2
0
def main():
    if not sh.which('pip3'):
        print('installing pip3')
        sh.apt_get("install", "python3-pip", "-y")
        if not sh.which('pip3'):
            print('pip3 install failed.')
            return
        print('pip3 installed')

    print('installing python package')
    print('flask.')
    sh.pip3("install", "flask")
    print('rsa.')
    sh.pip3("install", "rsa")

    if not sh.which('supervisorctl'):
        print('installing supervisor')
        sh.apt_get("install", "supervisor", "-y")
        if not sh.which('supervisorctl'):
            print('supervisor install failed')
            return
        print('supervisor installed')

    ans = input('Do you want to copy files to /root? [y/N]')
    if ans == 'Y' or ans == 'y':
        print('copying files to /root/Adence')
        sh.cp('../Adence', '-R', '/root')
        print('config supervisor')
        cmd = r'''[program:Adence]
command=python3 /root/Adence/main.py
autostart=true
autorestart=true
stderr_logfile=/var/log/Adence.err.log
stdout_logfile=/var/log/Adence.out.log
'''
        with open('/etc/supervisor/conf.d/Adence.conf', 'w') as fp:
            fp.write(cmd)
        sh.service('supervisor', 'restart')
        print('done. you can visit http://localhost:9000 now.')
    else:
        print('environment settled.you need to run the main.py manually')
示例#3
0
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'",
               "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('yagmail/__init__.py') as f:
    init = f.read()

with open('yagmail/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version),
               init))

print(sh.python3('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'yagmail'])
示例#4
0
文件: deploy.py 项目: uhoh/whereami
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'",
               "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('whereami/__init__.py') as f:
    init = f.read()

with open('whereami/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version),
               init))

print(sh.python('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'whereami'])
示例#5
0
文件: thenEn.py 项目: ExMedal/PyLib
    print("Python version: ", sh.python3("-V"))

    print("1) Lib for Web develop\n")
    print("2) Lib for Desktop GUI\n")
    print("3) Lib for Data Science\n")

    kutuphane = int(input("Which one do you want to download about: "))

    if (kutuphane == 1):
        print(
            " 1) Django      5) Flask\n 2) Pyramid \n 3) Web2Py \n 4) Dash \n 99) Quit \n\n"
        )
        web = int(input("Which one would you like to install? "))
        if (web == 1):
            sh.pip3("install", "Django")
            print("The library is loaded.")
            tm.sleep(3)
        elif (web == 2):
            sh.pip3("install", "pyramid")
            print("The library is loaded.")
            tm.sleep(3)
        elif (web == 3):
            sh.pip3("install", "web2py")
            print("The library is loaded.")
            tm.sleep(3)
        elif (web == 4):
            sh.pip3("install", "dash")
            print("The library is loaded.")
            tm.sleep(3)
        elif (web == 5):
示例#6
0
import sh
import re

commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'", "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('sky/__init__.py') as f:
    init = f.read()

with open('sky/__init__.py', 'w') as f:
    f.write(re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'sky'])
示例#7
0
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub(
    "MICRO_VERSION = '[0-9]+'",
    "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('cant/__init__.py') as f:
    init = f.read()

with open('cant/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"',
               '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'cant'])
示例#8
0
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub(
    "MICRO_VERSION = '[0-9]+'",
    "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('access_points/__init__.py') as f:
    init = f.read()

with open('access_points/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"',
               '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'access_points'])
示例#9
0
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub(
    "MICRO_VERSION = '[0-9]+'",
    "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('yagmail/__init__.py') as f:
    init = f.read()

with open('yagmail/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"',
               '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'yagmail'])
示例#10
0
文件: deploy.py 项目: kootenpv/xdb
import sh


commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'", "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('xdb/__init__.py') as f:
    init = f.read()

with open('xdb/__init__.py', 'w') as f:
    f.write(re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version), init))

print(sh.python('setup.py', ['sdist', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'xdb'])
示例#11
0
import sh
import re

commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'", "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0] 
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)    

with open('gittyleaks/__init__.py') as f: 
    init = f.read()
    
with open('gittyleaks/__init__.py', 'w') as f: 
    f.write(re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version), init))
    
print(sh.python('setup.py', ['sdist', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'gittyleaks'])
示例#12
0
文件: deploy.py 项目: kootenpv/xdb
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'",
               "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('xdb/__init__.py') as f:
    init = f.read()

with open('xdb/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version),
               init))

print(sh.python('setup.py', ['sdist', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'xdb'])
示例#13
0
import sh
import re

commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'", "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('gittraffic/__init__.py') as f:
    init = f.read()

with open('gittraffic/__init__.py', 'w') as f:
    f.write(re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['sdist', 'bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'gittraffic'])
示例#14
0
commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'",
               "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('sky/__init__.py') as f:
    init = f.read()

with open('sky/__init__.py', 'w') as f:
    f.write(
        re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version),
               init))

print(sh.python3('setup.py', ['bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'sky'])
示例#15
0
文件: deploy.py 项目: niibruce/xtoy
import sh
import re

commit_count = sh.git('rev-list', ['--all']).count('\n')

with open('setup.py') as f:
    setup = f.read()

setup = re.sub("MICRO_VERSION = '[0-9]+'", "MICRO_VERSION = '{}'".format(commit_count), setup)

major = re.search("MAJOR_VERSION = '([0-9]+)'", setup).groups()[0]
minor = re.search("MINOR_VERSION = '([0-9]+)'", setup).groups()[0]
micro = re.search("MICRO_VERSION = '([0-9]+)'", setup).groups()[0]
version = '{}.{}.{}'.format(major, minor, micro)

with open('setup.py', 'w') as f:
    f.write(setup)

with open('xtoy/__init__.py') as f:
    init = f.read()

with open('xtoy/__init__.py', 'w') as f:
    f.write(re.sub('__version__ = "[0-9.]+"', '__version__ = "{}"'.format(version), init))

print(sh.python3('setup.py', ['bdist_wheel', 'upload']))

sh.cd('../')

sh.pip3('install', ['-U', 'xtoy'])