You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2014/11/11 04:42:16 UTC
incubator-aurora git commit: Create the PyCharm project configuration
for easier IDE setup.
Repository: incubator-aurora
Updated Branches:
refs/heads/master c3cce813e -> c2412477d
Create the PyCharm project configuration for easier IDE setup.
Reviewed at https://reviews.apache.org/r/27779/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/c2412477
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/c2412477
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/c2412477
Branch: refs/heads/master
Commit: c2412477d5354851267f4bc6d976eb27df6f8a86
Parents: c3cce81
Author: Bill Farner <wf...@apache.org>
Authored: Mon Nov 10 19:42:00 2014 -0800
Committer: Bill Farner <wf...@apache.org>
Committed: Mon Nov 10 19:42:00 2014 -0800
----------------------------------------------------------------------
build-support/python/make-pycharm-virtualenv | 40 +++++++++++++++++++++--
1 file changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/c2412477/build-support/python/make-pycharm-virtualenv
----------------------------------------------------------------------
diff --git a/build-support/python/make-pycharm-virtualenv b/build-support/python/make-pycharm-virtualenv
index 0e7b97e..316ead7 100755
--- a/build-support/python/make-pycharm-virtualenv
+++ b/build-support/python/make-pycharm-virtualenv
@@ -17,6 +17,7 @@ set -e
HERE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
BUILDROOT=$HERE/../..
+VENV_DIR=build-support/python/pycharm.venv
pushd "$BUILDROOT"
./pants goal dependencies --dependencies-external src/test/python:all > requirements.txt
@@ -26,9 +27,9 @@ pushd "$BUILDROOT"
pytest_requirement=$(pip freeze | grep pytest==)
pytest_cov_requirement=$(pip freeze | grep pytest-cov==)
deactivate
- rm -rf build-support/python/pycharm.venv
- ./build-support/virtualenv build-support/python/pycharm.venv
- source build-support/python/pycharm.venv/bin/activate
+ rm -rf "$VENV_DIR"
+ ./build-support/virtualenv "$VENV_DIR"
+ source $VENV_DIR/bin/activate
# NOTE: PyCharm navigation (ctrl-click) doesn't work without --egg - it gets confused by
# the namespace packages in twitter.common.
pip install --egg -r requirements.txt
@@ -39,3 +40,36 @@ pushd "$BUILDROOT"
pip install $pytest_requirement $pytest_cov_requirement
deactivate
popd
+
+if [ ! -d .idea ]; then
+ echo Creating PyCharm project at .idea/aurora.iml
+ mkdir .idea
+ cat <<EOF > .idea/aurora.iml
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/python" isTestSource="false" />
+ </content>
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+ <component name="TestRunnerService">
+ <option name="projectConfiguration" value="py.test" />
+ <option name="PROJECT_TEST_RUNNER" value="py.test" />
+ </component>
+</module>
+EOF
+fi
+
+echo "Your PyCharm environment is now set up. You can open the project root
+directory with PyCharm.
+
+Once the project is loaded:
+ - open project settings
+ - click 'Project Interpreter'
+ - click the cog in the upper-right corner
+ - click 'Add Local'
+ - select '$VENV_DIR/bin/python'
+ - click 'OK'
+
+Once this is done, all imports should be recognized, and you can run unit tests in the IDE!"