| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # | 6 # |
| 7 # Script to push a package to pub. | 7 # Script to push a package to pub. |
| 8 # | 8 # |
| 9 # Usage: publish_pkg.py pkg_dir | 9 # Usage: publish_pkg.py pkg_dir |
| 10 # | 10 # |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 153 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 154 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 154 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 155 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 155 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 156 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 156 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 157 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 157 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 158 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 158 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 159 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 159 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 160 '''); | 160 '''); |
| 161 | 161 |
| 162 replaceInFiles.append( | 162 replaceInFiles.append( |
| 163 (r'(import|part)(\s+)(\'|")(\.\./)+pkg/', r'\1\2\3package:')) | 163 (r'(import|part)(\s+)(\'|")(\.\./)+pkg/([^/]+/)lib/', r'\1\2\3package:\5')) |
| 164 | 164 |
| 165 # Replace '../*/pkg' imports and parts. | 165 # Replace '../*/pkg' imports and parts. |
| 166 for root, dirs, files in os.walk(os.path.join(tmpDir, pkgName)): | 166 for root, dirs, files in os.walk(os.path.join(tmpDir, pkgName)): |
| 167 # TODO(dgrove): Remove this when dartbug.com/7487 is fixed. | 167 # TODO(dgrove): Remove this when dartbug.com/7487 is fixed. |
| 168 if '.svn' in dirs: | 168 if '.svn' in dirs: |
| 169 shutil.rmtree(os.path.join(root, '.svn')) | 169 shutil.rmtree(os.path.join(root, '.svn')) |
| 170 for name in files: | 170 for name in files: |
| 171 if name.endswith('.dart'): | 171 if name.endswith('.dart'): |
| 172 ReplaceInFiles([os.path.join(root, name)], replaceInFiles) | 172 ReplaceInFiles([os.path.join(root, name)], replaceInFiles) |
| 173 | 173 |
| 174 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' | 174 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' |
| 175 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) | 175 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) |
| 176 shutil.rmtree(tmpDir) | 176 shutil.rmtree(tmpDir) |
| 177 | 177 |
| 178 if __name__ == '__main__': | 178 if __name__ == '__main__': |
| 179 sys.exit(Main(sys.argv)) | 179 sys.exit(Main(sys.argv)) |
| OLD | NEW |