Index: third_party/mojo/src/mojo/public/tools/dart_pkg.py |
diff --git a/third_party/mojo/src/mojo/public/tools/dart_pkg.py b/third_party/mojo/src/mojo/public/tools/dart_pkg.py |
index 86ae5d5b83c36ad3eeed10bdbbf916daa853cd27..d0f0d6ebb18b767bd5eadfbfdbdab602a40691c7 100755 |
--- a/third_party/mojo/src/mojo/public/tools/dart_pkg.py |
+++ b/third_party/mojo/src/mojo/public/tools/dart_pkg.py |
@@ -8,7 +8,6 @@ |
import argparse |
import errno |
-import json |
import os |
import shutil |
import sys |
@@ -48,9 +47,8 @@ |
def ensure_dir_exists(path): |
- abspath = os.path.abspath(path) |
- if not os.path.exists(abspath): |
- os.makedirs(abspath) |
+ if not os.path.exists(path): |
+ os.makedirs(path) |
def has_pubspec_yaml(paths): |
@@ -106,13 +104,6 @@ |
else: |
copy(from_root, to_root, filter_func) |
- |
-def remove_if_exists(path): |
- try: |
- os.remove(path) |
- except OSError as e: |
- if e.errno != errno.ENOENT: |
- raise |
def list_files(from_root, filter_func=None): |
file_list = [] |
@@ -196,39 +187,13 @@ |
help='Directory containing .dart sources', |
nargs='*', |
default=[]) |
- parser.add_argument('--sdk-ext-files', |
- metavar='sdk_ext_files', |
- help='List of .dart files that are part of of sdk_ext.', |
- nargs='*', |
- default=[]) |
- parser.add_argument('--sdk-ext-mappings', |
- metavar='sdk_ext_mappings', |
- help='Mappings for SDK extension libraries.', |
- nargs='*', |
- default=[]) |
args = parser.parse_args() |
# We must have a pubspec.yaml. |
assert has_pubspec_yaml(args.package_sources) |
+ # Copy or symlink package sources into pkg directory. |
target_dir = os.path.join(args.pkg_directory, args.package_name) |
- lib_path = os.path.join(target_dir, "lib") |
- |
- mappings = {} |
- for mapping in args.sdk_ext_mappings: |
- library, path = mapping.split(',', 1) |
- mappings[library] = '../sdk_ext/%s' % path |
- |
- sdkext_path = os.path.join(lib_path, '_sdkext') |
- if mappings: |
- ensure_dir_exists(lib_path) |
- with open(sdkext_path, 'w') as stream: |
- json.dump(mappings, stream, sort_keys=True, |
- indent=2, separators=(',', ': ')) |
- else: |
- remove_if_exists(sdkext_path) |
- |
- # Copy or symlink package sources into pkg directory. |
common_source_prefix = os.path.commonprefix(args.package_sources) |
for source in args.package_sources: |
relative_source = os.path.relpath(source, common_source_prefix) |
@@ -244,12 +209,8 @@ |
relative_source = os.path.relpath(source, common_prefix) |
target = os.path.join(sdk_ext_dir, relative_source) |
copy_or_link(source, target) |
- for source in args.sdk_ext_files: |
- common_prefix = os.path.commonprefix(args.sdk_ext_files) |
- relative_source = os.path.relpath(source, common_prefix) |
- target = os.path.join(sdk_ext_dir, relative_source) |
- copy_or_link(source, target) |
- |
+ |
+ lib_path = os.path.join(target_dir, "lib") |
lib_mojom_path = os.path.join(lib_path, "mojom") |
# Copy generated mojom.dart files. |