Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: run.py

Issue 29338249: [abpcrawler] Fix run.py where __file__ doesn't include the path (Closed)
Patch Set: Created March 14, 2016, 2:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 import argparse 4 import argparse
5 import datetime 5 import datetime
6 import errno 6 import errno
7 import hashlib 7 import hashlib
8 import io 8 import io
9 import json 9 import json
10 import os 10 import os
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ) 110 )
111 parser.add_argument( 111 parser.add_argument(
112 'outdir', type=str, 112 'outdir', type=str,
113 help='directory to write data into' 113 help='directory to write data into'
114 ) 114 )
115 parameters = parser.parse_args() 115 parameters = parser.parse_args()
116 116
117 import buildtools.packagerGecko as packager 117 import buildtools.packagerGecko as packager
118 cleanup = [] 118 cleanup = []
119 try: 119 try:
120 base_dir = os.path.dirname(__file__) 120 base_dir = os.path.dirname(os.path.abspath(__file__))
121 handle, crawlerxpi = tempfile.mkstemp(suffix='.xpi') 121 handle, crawlerxpi = tempfile.mkstemp(suffix='.xpi')
122 os.close(handle) 122 os.close(handle)
123 cleanup.append(crawlerxpi) 123 cleanup.append(crawlerxpi)
124 packager.createBuild(base_dir, outFile=crawlerxpi, releaseBuild=True) 124 packager.createBuild(base_dir, outFile=crawlerxpi, releaseBuild=True)
125 125
126 abpxpi = 'https://addons.mozilla.org/firefox/downloads/latest/1865/addon-186 5-latest.xpi' 126 abpxpi = 'https://addons.mozilla.org/firefox/downloads/latest/1865/addon-186 5-latest.xpi'
127 if parameters.abpdir: 127 if parameters.abpdir:
128 handle, abpxpi = tempfile.mkstemp(suffix='.xpi') 128 handle, abpxpi = tempfile.mkstemp(suffix='.xpi')
129 os.close(handle) 129 os.close(handle)
130 cleanup.append(abpxpi) 130 cleanup.append(abpxpi)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 191 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
192 DEPENDENCY_SCRIPT = os.path.join(BASE_DIR, "ensure_dependencies.py") 192 DEPENDENCY_SCRIPT = os.path.join(BASE_DIR, "ensure_dependencies.py")
193 193
194 try: 194 try:
195 subprocess.check_call([sys.executable, DEPENDENCY_SCRIPT, BASE_DIR]) 195 subprocess.check_call([sys.executable, DEPENDENCY_SCRIPT, BASE_DIR])
196 except subprocess.CalledProcessError as e: 196 except subprocess.CalledProcessError as e:
197 print >>sys.stderr, e 197 print >>sys.stderr, e
198 print >>sys.stderr, "Failed to ensure dependencies being up-to-date!" 198 print >>sys.stderr, "Failed to ensure dependencies being up-to-date!"
199 199
200 run() 200 run()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld