| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 # Copy libraries.dart into the package source code | 131 # Copy libraries.dart into the package source code |
| 132 shutil.copy(libpath, os.path.join(tmpDir, pkgName, 'lib/libraries.dart')) | 132 shutil.copy(libpath, os.path.join(tmpDir, pkgName, 'lib/libraries.dart')) |
| 133 | 133 |
| 134 # Replace '../../libraries.dart' with '../libraries.dart' | 134 # Replace '../../libraries.dart' with '../libraries.dart' |
| 135 replaceInDart.append( | 135 replaceInDart.append( |
| 136 (r'(import|part)(\s+)(\'|")\.\./(\.\./)*libraries.dart', | 136 (r'(import|part)(\s+)(\'|")\.\./(\.\./)*libraries.dart', |
| 137 r'\1\2\3\4libraries.dart')) | 137 r'\1\2\3\4libraries.dart')) |
| 138 | 138 |
| 139 if not os.path.exists(os.path.join(tmpDir, pkgName, 'LICENSE')): | 139 if not os.path.exists(os.path.join(tmpDir, pkgName, 'LICENSE')): |
| 140 with open(os.path.join(tmpDir, pkgName, 'LICENSE'), 'w') as licenseFile: | 140 with open(os.path.join(tmpDir, pkgName, 'LICENSE'), 'w') as licenseFile: |
| 141 licenseFile.write(''' | 141 licenseFile.write( |
| 142 Copyright 2012, the Dart project authors. All rights reserved. | 142 '''Copyright 2012, the Dart project authors. All rights reserved. |
| 143 Redistribution and use in source and binary forms, with or without | 143 Redistribution and use in source and binary forms, with or without |
| 144 modification, are permitted provided that the following conditions are | 144 modification, are permitted provided that the following conditions are |
| 145 met: | 145 met: |
| 146 |
| 146 * Redistributions of source code must retain the above copyright | 147 * Redistributions of source code must retain the above copyright |
| 147 notice, this list of conditions and the following disclaimer. | 148 notice, this list of conditions and the following disclaimer. |
| 148 * Redistributions in binary form must reproduce the above | 149 * Redistributions in binary form must reproduce the above |
| 149 copyright notice, this list of conditions and the following | 150 copyright notice, this list of conditions and the following |
| 150 disclaimer in the documentation and/or other materials provided | 151 disclaimer in the documentation and/or other materials provided |
| 151 with the distribution. | 152 with the distribution. |
| 152 * Neither the name of Google Inc. nor the names of its | 153 * Neither the name of Google Inc. nor the names of its |
| 153 contributors may be used to endorse or promote products derived | 154 contributors may be used to endorse or promote products derived |
| 154 from this software without specific prior written permission. | 155 from this software without specific prior written permission. |
| 156 |
| 155 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 157 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 156 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 158 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 157 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 159 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 158 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 160 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 159 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 161 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 160 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 162 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 161 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 163 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 162 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 164 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 163 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 165 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 164 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 166 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| (...skipping 13 matching lines...) Expand all Loading... |
| 178 ReplaceInFiles([os.path.join(root, name)], replaceInDart) | 180 ReplaceInFiles([os.path.join(root, name)], replaceInDart) |
| 179 elif name == 'pubspec.yaml': | 181 elif name == 'pubspec.yaml': |
| 180 ReplaceInFiles([os.path.join(root, name)], replaceInPubspec) | 182 ReplaceInFiles([os.path.join(root, name)], replaceInPubspec) |
| 181 | 183 |
| 182 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' | 184 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' |
| 183 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) | 185 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) |
| 184 shutil.rmtree(tmpDir) | 186 shutil.rmtree(tmpDir) |
| 185 | 187 |
| 186 if __name__ == '__main__': | 188 if __name__ == '__main__': |
| 187 sys.exit(Main(sys.argv)) | 189 sys.exit(Main(sys.argv)) |
| OLD | NEW |