def main() -> None: # Get the correct Python interpreter. If we don't do this and use # `virtualenv -p python3` to create the venv in Travis, the venv # starts referring to the system Python interpreter. python_interpreter = subprocess_text_output(['which', 'python3']) setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', python_interpreter])
def main(): # type: () -> int run(["sudo", "apt-get", "update"]) run(["sudo", "apt-get", "-y", "install", "--no-install-recommends"] + APT_DEPENDENCIES[codename]) if subprocess.call(['dpkg', '-s', TSEARCH_PACKAGE_NAME]): temp_deb_path = subprocess.check_output(["mktemp", "package_XXXXXX.deb", "--tmpdir"]) run(["wget", "-O", temp_deb_path, TSEARCH_URL]) run(["sudo", "dpkg", "--install", temp_deb_path]) setup_virtualenv(PY3_VENV_PATH, os.path.join(ZULIP_PATH, "requirements", "mypy.txt"), virtualenv_args=['-p', 'python3']) setup_virtualenv(VENV_PATH, os.path.join(ZULIP_PATH, "requirements", "dev.txt")) # Put Python2 virtualenv activation in our .bash_profile. with open(os.path.expanduser('~/.bash_profile'), 'w+') as bash_profile: bash_profile.writelines([ "source .bashrc\n", "source %s\n" % (os.path.join(VENV_PATH, "bin", "activate"),), ]) run(["sudo", "cp", REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH]) # npm install and management commands expect to be run from the root of the # project. os.chdir(ZULIP_PATH) if "--travis" in sys.argv: run(["tools/setup/install-phantomjs", "--travis"]) else: run(["tools/setup/install-phantomjs"]) run(["tools/setup/download-zxcvbn"]) run(["tools/setup/emoji_dump/build_emoji"]) run(["scripts/setup/generate_secrets.py", "-d"]) if "--travis" in sys.argv and '--production-travis' not in sys.argv: run(["sudo", "service", "rabbitmq-server", "restart"]) run(["sudo", "service", "redis-server", "restart"]) run(["sudo", "service", "memcached", "restart"]) elif "--docker" in sys.argv: run(["sudo", "service", "rabbitmq-server", "restart"]) run(["sudo", "pg_dropcluster", "--stop", POSTGRES_VERSION, "main"]) run(["sudo", "pg_createcluster", "-e", "utf8", "--start", POSTGRES_VERSION, "main"]) run(["sudo", "service", "redis-server", "restart"]) run(["sudo", "service", "memcached", "restart"]) if '--production-travis' not in sys.argv: # These won't be used anyway run(["scripts/setup/configure-rabbitmq"]) run(["tools/setup/postgres-init-dev-db"]) run(["tools/do-destroy-rebuild-database"]) run(["tools/setup/postgres-init-test-db"]) run(["tools/do-destroy-rebuild-test-database"]) run(["python", "./manage.py", "compilemessages"]) # Install the pinned version of npm. install_npm() # Run npm install last because it can be flaky, and that way one # only needs to rerun `npm install` to fix the installation. setup_node_modules() return 0
def main(): # type: () -> None PY2_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt") setup_virtualenv("/srv/zulip-venv", PY2_DEV_REQS_FILE, patch_activate_script=True) PY3_DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt") setup_virtualenv("/srv/zulip-py3-venv", PY3_DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', 'python3'])
def main() -> None: # Get the correct Python interpreter. If we don't do this and use # `virtualenv -p python3` to create the venv in Travis, the venv # starts referring to the system Python interpreter. python_interpreter = subprocess_text_output(['which', 'python3']) setup_virtualenv("/srv/zulip-thumbor-venv", THUMBOR_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', 'python2.7']) cached_venv_path = setup_virtualenv( VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', python_interpreter]) overwrite_symlink(cached_venv_path, os.path.join(ZULIP_PATH, "zulip-py3-venv"))
def main(is_travis=False): # type: (bool) -> None # Get the correct Python interpreter. If we don't do this and use # `virtualenv -p python3` to create the venv in Travis, the venv # starts referring to the system Python interpreter. python_interpreter = subprocess_text_output(['which', 'python3']) if is_travis: setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', python_interpreter]) else: run(['sudo', 'rm', '-f', OLD_VENV_PATH]) setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', python_interpreter])
def main() -> None: cached_venv_path = setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True) overwrite_symlink(cached_venv_path, os.path.join(ZULIP_PATH, "zulip-py3-venv"))
def main(): # type: () -> int # npm install and management commands expect to be run from the root of the # project. os.chdir(ZULIP_PATH) run(["sudo", "./scripts/lib/setup-apt-repo"]) # Add groonga repository to get the pgroonga packages run(["sudo", "add-apt-repository", "-y", "ppa:groonga/ppa"]) run(["sudo", "apt-get", "update"]) run(["sudo", "apt-get", "-y", "install", "--no-install-recommends"] + APT_DEPENDENCIES[codename]) if TRAVIS: if PY2: MYPY_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "mypy.txt") setup_virtualenv(PY3_VENV_PATH, MYPY_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', 'python3']) DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py2_dev.txt") setup_virtualenv(PY2_VENV_PATH, DEV_REQS_FILE, patch_activate_script=True) else: TWISTED_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "twisted.txt") setup_virtualenv("/srv/zulip-py2-twisted-venv", TWISTED_REQS_FILE, patch_activate_script=True) DEV_REQS_FILE = os.path.join(ZULIP_PATH, "requirements", "py3_dev.txt") setup_virtualenv(VENV_PATH, DEV_REQS_FILE, patch_activate_script=True, virtualenv_args=['-p', 'python3']) else: # Import tools/setup_venv.py instead of running it so that we get an # activated virtualenv for the rest of the provisioning process. from tools.setup import setup_venvs setup_venvs.main() # Put Python2 virtualenv activation in our .bash_profile. with open(os.path.expanduser('~/.bash_profile'), 'w+') as bash_profile: bash_profile.writelines([ "source .bashrc\n", "source %s\n" % (os.path.join(VENV_PATH, "bin", "activate"),), ]) run(["sudo", "cp", REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH]) # create log directory `zulip/var/log` run(["mkdir", "-p", LOG_DIR_PATH]) # create upload directory `var/uploads` run(["mkdir", "-p", UPLOAD_DIR_PATH]) # create test upload directory `var/test_upload` run(["mkdir", "-p", TEST_UPLOAD_DIR_PATH]) # create coverage directory`var/coverage` run(["mkdir", "-p", COVERAGE_DIR_PATH]) # create linecoverage directory`var/linecoverage-report` run(["mkdir", "-p", LINECOVERAGE_DIR_PATH]) # create linecoverage directory`var/node-coverage` run(["mkdir", "-p", NODE_TEST_COVERAGE_DIR_PATH]) if TRAVIS: run(["tools/setup/install-phantomjs", "--travis"]) else: run(["tools/setup/install-phantomjs"]) run(["tools/setup/download-zxcvbn"]) run(["tools/setup/emoji_dump/build_emoji"]) run(["scripts/setup/generate_secrets.py", "-d"]) if TRAVIS and not PRODUCTION_TRAVIS: run(["sudo", "service", "rabbitmq-server", "restart"]) run(["sudo", "service", "redis-server", "restart"]) run(["sudo", "service", "memcached", "restart"]) elif "--docker" in sys.argv: run(["sudo", "service", "rabbitmq-server", "restart"]) run(["sudo", "pg_dropcluster", "--stop", POSTGRES_VERSION, "main"]) run(["sudo", "pg_createcluster", "-e", "utf8", "--start", POSTGRES_VERSION, "main"]) run(["sudo", "service", "redis-server", "restart"]) run(["sudo", "service", "memcached", "restart"]) if not PRODUCTION_TRAVIS: # These won't be used anyway run(["scripts/setup/configure-rabbitmq"]) run(["tools/setup/postgres-init-dev-db"]) run(["tools/do-destroy-rebuild-database"]) run(["tools/setup/postgres-init-test-db"]) run(["tools/do-destroy-rebuild-test-database"]) run(["python", "./manage.py", "compilemessages"]) # Install the pinned version of npm. install_npm() # Run npm install last because it can be flaky, and that way one # only needs to rerun `npm install` to fix the installation. try: setup_node_modules() except subprocess.CalledProcessError: print(WARNING + "`npm install` failed; retrying..." + ENDC) setup_node_modules() print() print(OKBLUE + "Zulip development environment setup succeeded!" + ENDC) return 0
def main() -> None: setup_virtualenv("/srv/zulip-thumbor-venv", THUMBOR_REQS_FILE, patch_activate_script=True, python2=True) cached_venv_path = setup_virtualenv( VENV_PATH, DEV_REQS_FILE, patch_activate_script=True) overwrite_symlink(cached_venv_path, os.path.join(ZULIP_PATH, "zulip-py3-venv"))