##// END OF EJS Templates
Fix upload tool to automatically create directories.
Fernando Perez -
Show More
@@ -1,21 +1,22 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Simple upload script to push up into the testing directory a local build
2 """Simple upload script to push up into the testing directory a local build
3 """
3 """
4 from __future__ import print_function
4 from __future__ import print_function
5
5
6 from toollib import *
6 from toollib import *
7
7
8 # Get main ipython dir, this will raise if it doesn't pass some checks
8 # Get main ipython dir, this will raise if it doesn't pass some checks
9 ipdir = get_ipdir()
9 ipdir = get_ipdir()
10 distdir = pjoin(ipdir, 'dist')
10 distdir = pjoin(ipdir, 'dist')
11
11
12 # Load release info
12 # Load release info
13 execfile(pjoin(ipdir, 'IPython','core','release.py'))
13 execfile(pjoin(ipdir, 'IPython','core','release.py'))
14
14
15 # Build site addresses for file uploads
15 # Build site addresses for file uploads
16 testing_site = '%s/testing/%s' % (archive, version)
16 testing_site = '%s/testing/%s' % (archive, version)
17
17
18 cd(distdir)
18 cd(distdir)
19
19
20 # FIXME: this assumes the path *with the version number* exists on the server
20 # Create remote path if it doesn't exist.
21 sh('ssh %s "mkdir -p %s/testing/%s" ' % (archive_user, archive_dir, version))
21 sh('scp * %s' % testing_site)
22 sh('scp * %s' % testing_site)
@@ -1,55 +1,57 b''
1 """Various utilities common to IPython release and maintenance tools.
1 """Various utilities common to IPython release and maintenance tools.
2 """
2 """
3 from __future__ import print_function
3 from __future__ import print_function
4
4
5 # Library imports
5 # Library imports
6 import os
6 import os
7 import sys
7 import sys
8
8
9 from distutils.dir_util import remove_tree
9 from distutils.dir_util import remove_tree
10
10
11 # Useful shorthands
11 # Useful shorthands
12 pjoin = os.path.join
12 pjoin = os.path.join
13 cd = os.chdir
13 cd = os.chdir
14
14
15 # Constants
15 # Constants
16
16
17 # SSH root address of the archive site
17 # SSH root address of the archive site
18 archive = 'ipython@archive.ipython.org:archive.ipython.org'
18 archive_user = 'ipython@archive.ipython.org'
19 archive_dir = 'archive.ipython.org'
20 archive = '%s:%s' % (archive_user, archive_dir)
19
21
20 # Utility functions
22 # Utility functions
21 def sh(cmd):
23 def sh(cmd):
22 """Run system command in shell, raise SystemExit if it returns an error."""
24 """Run system command in shell, raise SystemExit if it returns an error."""
23 print("$", cmd)
25 print("$", cmd)
24 stat = os.system(cmd)
26 stat = os.system(cmd)
25 #stat = 0 # Uncomment this and comment previous to run in debug mode
27 #stat = 0 # Uncomment this and comment previous to run in debug mode
26 if stat:
28 if stat:
27 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
29 raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
28
30
29 # Backwards compatibility
31 # Backwards compatibility
30 c = sh
32 c = sh
31
33
32 def get_ipdir():
34 def get_ipdir():
33 """Get IPython directory from command line, or assume it's the one above."""
35 """Get IPython directory from command line, or assume it's the one above."""
34
36
35 # Initialize arguments and check location
37 # Initialize arguments and check location
36 try:
38 try:
37 ipdir = sys.argv[1]
39 ipdir = sys.argv[1]
38 except IndexError:
40 except IndexError:
39 ipdir = '..'
41 ipdir = '..'
40
42
41 ipdir = os.path.abspath(ipdir)
43 ipdir = os.path.abspath(ipdir)
42
44
43 cd(ipdir)
45 cd(ipdir)
44 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
46 if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
45 raise SystemExit('Invalid ipython directory: %s' % ipdir)
47 raise SystemExit('Invalid ipython directory: %s' % ipdir)
46 return ipdir
48 return ipdir
47
49
48
50
49 def compile_tree():
51 def compile_tree():
50 """Compile all Python files below current directory."""
52 """Compile all Python files below current directory."""
51 stat = os.system('python -m compileall .')
53 stat = os.system('python -m compileall .')
52 if stat:
54 if stat:
53 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
55 msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
54 msg += 'See messages above for the actual file that produced it.\n'
56 msg += 'See messages above for the actual file that produced it.\n'
55 raise SystemExit(msg)
57 raise SystemExit(msg)
General Comments 0
You need to be logged in to leave comments. Login now