Skip to content
Snippets Groups Projects
Commit faf79574 authored by Jesse Zoldak's avatar Jesse Zoldak
Browse files

Remove obsolete files

parent 5553e7dd
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
"""
Script to generate alton and git commands for executing hotfixes
Commands for:
- cutting amis
- creating hotfix tag
The script should be run with the hotfix's git hash as a command-line argument.
i.e. `python scripts/hotfix.py <hotfix hash>`
"""
from __future__ import print_function
import argparse
import sys
import textwrap
from datetime import date
def generate_alton_commands(hotfix_hash):
"""
Generates commands for alton to cut amis from the git hash of the hotfix.
"""
template = textwrap.dedent("""
@alton cut ami for stage-edx-edxapp from prod-edx-edxapp with edx_platform_version={hotfix_hash}
@alton cut ami for prod-edge-edxapp from prod-edge-edxapp with edx_platform_version={hotfix_hash}
@alton cut ami for prod-edx-edxapp from prod-edx-edxapp with edx_platform_version={hotfix_hash}
""")
return template.strip().format(hotfix_hash=hotfix_hash)
def generate_git_command(hotfix_hash):
"""
Generates command to tag the git hash of the hotfix.
"""
git_string = 'git tag -a hotfix-{iso_date} -m "Hotfix for {msg_date}" {hotfix_hash}'.format(
iso_date=date.today().isoformat(),
msg_date=date.today().strftime("%b %d, %Y"),
hotfix_hash=hotfix_hash,
)
return git_string
def main():
parser = argparse.ArgumentParser(description="Generate alton and git commands for hotfixes")
parser.add_argument("hash", help="git hash for hotfix")
args = parser.parse_args()
hotfix_hash = args.hash
print("\nHere are the alton commands to cut the hotfix amis:")
print(generate_alton_commands(hotfix_hash))
print("\nHere is the git command to generate the hotfix tag:")
print(generate_git_command(hotfix_hash))
print("\nOnce you create the git tag, push the tag by running:")
print("git push --tags\n")
if __name__ == '__main__':
main()
This diff is collapsed.
paver lms
#! /usr/bin/env python
# This script requires that you have watchdog installed. You can install
# watchdog via 'pip install watchdog'
import logging
import os
import sys
import time
from signal import SIGTERM
from subprocess import Popen
from watchdog.events import FileSystemEventHandler, LoggingEventHandler
from watchdog.observers import Observer
# To watch more (or more specific) directories, change WATCH_DIRS to include the
# directories you want to watch. Note that this is recursive. If you want to
# watch fewer or more extensions, you can change EXTENSIONS. To watch all
# extensions, add "*" to EXTENSIONS.
WATCH_DIRS = ["../data", "common/lib/xmodule/xmodule/js", "common/lib/xmodule/xmodule/css"]
EXTENSIONS = ["*", "xml", "js", "css", "coffee", "scss", "html"]
WATCH_DIRS = [os.path.abspath(os.path.normpath(dir)) for dir in WATCH_DIRS]
class DjangoEventHandler(FileSystemEventHandler):
def __init__(self, process):
super(DjangoEventHandler, self).__init__()
self.process = process
def on_any_event(self, event):
for extension in EXTENSIONS:
if event.src_path.endswith(extension) or extension == "*":
print "%s changed: restarting server." % event.src_path
os.system("touch lms/__init__.py")
break
if __name__ == "__main__":
event_handler = DjangoEventHandler(Popen(['paver', 'lms']))
observer = Observer()
for dir in WATCH_DIRS:
observer.schedule(event_handler, dir, recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
#!/usr/bin/env python
import argparse
import os
import sys
# I want this:
# ERROR: test_update_and_fetch (edx-platform.cms.djangoapps.contentstore.tests.test_course_settings.CourseDetailsViewTest)
# to become:
# test --settings=cms.envs.test --pythonpath=. -s cms/djangoapps/contentstore/tests/test_course_settings.py:CourseDetailsViewTest.test_update_and_fetch
def find_full_path(path_to_file):
"""Find the full path where we only have a relative path from somewhere in the tree."""
for subdir, dirs, files in os.walk("."):
full = os.path.relpath(os.path.join(subdir, path_to_file))
if os.path.exists(full):
return full
def main(argv):
parser = argparse.ArgumentParser(description="Run just one test")
parser.add_argument('--nocapture', '-s', action='store_true', help="Don't capture stdout (any stdout output will be printed immediately)")
parser.add_argument('--pdb', action='store_true', help="Use pdb for test errors")
parser.add_argument('--pdb-fail', action='store_true', help="Use pdb for test failures")
parser.add_argument('words', metavar="WORDS", nargs='+', help="The description of a test failure, like 'ERROR: test_set_missing_field (courseware.tests.test_model_data.TestStudentModuleStorage)'")
args = parser.parse_args(argv)
words = []
# Collect all the words, ignoring what was quoted together, and get rid of parens.
for argword in args.words:
words.extend(w.strip("()") for w in argword.split())
# If it starts with "ERROR:" or "FAIL:", just ignore that.
if words[0].endswith(':'):
del words[0]
if len(words) == 1:
test_path, test_method = words[0].rsplit('.', 1)
test_path = test_path.split('.')
else:
test_method = words[0]
test_path = words[1].split('.')
if test_path[0] == 'edx-platform':
del test_path[0]
test_class = test_path[-1]
del test_path[-1]
test_py_path = "%s.py" % ("/".join(test_path))
test_py_path = find_full_path(test_py_path)
test_spec = "%s:%s.%s" % (test_py_path, test_class, test_method)
system = None
if test_py_path.startswith('cms'):
system = 'cms'
elif test_py_path.startswith('lms'):
system = 'lms'
if system:
# Run as a django test suite
from django.core import management
os.environ['DJANGO_SETTINGS_MODULE'] = system + '.envs.test'
django_args = ["./manage.py", "test"]
if args.nocapture:
django_args.append("-s")
if args.pdb:
django_args.append("--pdb")
if args.pdb_fail:
django_args.append("--pdb-fail")
django_args.append(test_spec)
print " ".join(django_args)
management.execute_from_command_line(django_args)
else:
# Run as a nose test suite
import nose.core
nose_args = ["nosetests"]
if args.nocapture:
nose_args.append("-s")
nose_args.append(test_spec)
print " ".join(nose_args)
nose.core.main(argv=nose_args)
if __name__ == "__main__":
main(sys.argv[1:])
#!/usr/bin/env bash
# Create symlinks from ~/edx_all/data or $ROOT/data, with root passed as first arg
# to all the test courses in edx-platform/common/test/data/
# posix compliant sanity check
if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then
echo "Please use the bash interpreter to run this script"
exit 1
fi
ROOT="${1:-$HOME/edx_all}"
if [[ ! -d "$ROOT" ]]; then
echo "'$ROOT' is not a directory"
exit 1
fi
if [[ ! -d "$ROOT/edx-platform" ]]; then
echo "'$ROOT' is not the root edx_all directory"
exit 1
fi
if [[ ! -d "$ROOT/data" ]]; then
echo "'$ROOT' is not the root edx_all directory"
exit 1
fi
echo "ROOT is $ROOT"
cd $ROOT/data
for course in $(/bin/ls ../edx-platform/common/test/data/)
do
# Get rid of the symlink if it already exists
if [[ -L "$course" ]]; then
echo "Removing link to '$course'"
rm -f $course
fi
echo "Make link to '$course'"
# Create it
ln -s "../edx-platform/common/test/data/$course"
done
# go back to where we came from
cd -
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment