Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1773)

Unified Diff: tools/publish_pkg.py

Issue 12225059: fix publish for analyzer-experimental (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also fix publish_all Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/publish_all_pkgs.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/publish_pkg.py
diff --git a/tools/publish_pkg.py b/tools/publish_pkg.py
index 9861a8d63297c2e21037c6f5115b8aeee596a115..d1629c9ea88841d86e727829d11837c6f8e48fd0 100755
--- a/tools/publish_pkg.py
+++ b/tools/publish_pkg.py
@@ -58,11 +58,12 @@ def Main(argv):
version = '%d.%d.%d' % (major, minor, build)
tmpDir = tempfile.mkdtemp()
- pkgName = argv[1].split('/').pop()
+ pkgName = os.path.basename(os.path.normpath(argv[1]))
pubspec = os.path.join(tmpDir, pkgName, 'pubspec.yaml')
- replaceInFiles = []
+ replaceInDart = []
+ replaceInPubspec = []
if os.path.exists(os.path.join(HOME, argv[1], 'pubspec.yaml')):
#
@@ -126,7 +127,7 @@ def Main(argv):
shutil.copy(libpath, os.path.join(tmpDir, pkgName, 'lib/libraries.dart'))
# Replace '../../libraries.dart' with '../libraries.dart'
- replaceInFiles.append(
+ replaceInDart.append(
(r'(import|part)(\s+)(\'|")\.\./(\.\./)*libraries.dart',
r'\1\2\3\4libraries.dart'))
@@ -159,7 +160,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
''');
- replaceInFiles.append(
+ # TODO(jmesserly): this is a hack to make analyzer-experimental work.
+ if pkgName.endswith('-experimental'):
+ pkgReplace = (pkgName, pkgName.replace('-', '_'))
+ replaceInDart.append(pkgReplace)
+ replaceInPubspec.append(pkgReplace)
+
+ replaceInDart.append(
(r'(import|part)(\s+)(\'|")(\.\./)+pkg/([^/]+/)lib/', r'\1\2\3package:\5'))
# Replace '../*/pkg' imports and parts.
@@ -169,7 +176,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
shutil.rmtree(os.path.join(root, '.svn'))
for name in files:
if name.endswith('.dart'):
- ReplaceInFiles([os.path.join(root, name)], replaceInFiles)
+ ReplaceInFiles([os.path.join(root, name)], replaceInDart)
+ elif name == 'pubspec.yaml':
+ ReplaceInFiles([os.path.join(root, name)], replaceInPubspec)
print 'publishing version ' + version + ' of ' + argv[1] + ' to pub.\n'
subprocess.call(['pub', 'publish'], cwd=os.path.join(tmpDir, pkgName))
« no previous file with comments | « tools/publish_all_pkgs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698