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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 2013, 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 |
147 * Redistributions of source code must retain the above copyright | 147 * Redistributions of source code must retain the above copyright |
148 notice, this list of conditions and the following disclaimer. | 148 notice, this list of conditions and the following disclaimer. |
149 * Redistributions in binary form must reproduce the above | 149 * Redistributions in binary form must reproduce the above |
150 copyright notice, this list of conditions and the following | 150 copyright notice, this list of conditions and the following |
151 disclaimer in the documentation and/or other materials provided | 151 disclaimer in the documentation and/or other materials provided |
152 with the distribution. | 152 with the distribution. |
(...skipping 27 matching lines...) Expand all Loading... |
180 ReplaceInFiles([os.path.join(root, name)], replaceInDart) | 180 ReplaceInFiles([os.path.join(root, name)], replaceInDart) |
181 elif name == 'pubspec.yaml': | 181 elif name == 'pubspec.yaml': |
182 ReplaceInFiles([os.path.join(root, name)], replaceInPubspec) | 182 ReplaceInFiles([os.path.join(root, name)], replaceInPubspec) |
183 | 183 |
184 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' | 184 print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n' |
185 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) | 185 subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName)) |
186 shutil.rmtree(tmpDir) | 186 shutil.rmtree(tmpDir) |
187 | 187 |
188 if __name__ == '__main__': | 188 if __name__ == '__main__': |
189 sys.exit(Main(sys.argv)) | 189 sys.exit(Main(sys.argv)) |
OLD | NEW |