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')
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')
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'])
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'])
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):
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'])
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'])
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'])
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'])
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'])
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'])
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'])
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'])
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'])
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'])