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

Side by Side Diff: mojo/public/python/rules.gni

Issue 855043003: Revert "Content handler for python." (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « mojo/public/python/mojo_bindings/reflection.py ('k') | mojo/public/python/src/common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Rules to generate python packaged applications for Mojo
6
7 import("../mojo_sdk.gni")
8
9 template("python_package") {
10 action(target_name) {
11 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root)
12
13 inputs = invoker.sources
14
15 deps = []
16 zip_inputs = []
17
18 if (defined(invoker.deps)) {
19 deps += invoker.deps
20 foreach(d, invoker.deps) {
21 dep_name = get_label_info(d, "name")
22 dep_target_out_dir = get_label_info(d, "target_out_dir")
23 zip_inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ]
24 }
25 }
26
27 if (defined(invoker.datadeps)) {
28 datadeps = invoker.datadeps
29 }
30
31 output = "$target_out_dir/$target_name.pyzip"
32 outputs = [
33 output,
34 ]
35
36 rebase_base_dir =
37 rebase_path(get_label_info(":$target_name", "dir"), root_build_dir)
38 rebase_inputs = rebase_path(inputs, root_build_dir)
39 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir)
40 rebase_output = rebase_path(output, root_build_dir)
41 args = [
42 "--base-dir=$rebase_base_dir",
43 "--inputs=$rebase_inputs",
44 "--zip-inputs=$rebase_zip_inputs",
45 "--output=$rebase_output",
46 ]
47 }
48 }
49
50 # Use this template to generate a .mojo python application. One of the source
51 # files should be named __mojo__.py and contain a MojoMain function as the
52 # entry point. Dependencies of python_packaged_application targets should be
53 # either mojom targets (and specified using the mojom_deps variable) or
54 # python_package targets.
55 template("python_packaged_application") {
56 package_name = "${target_name}_package"
57 package_output = "$target_out_dir/$package_name.pyzip"
58
59 if (defined(invoker.output_name)) {
60 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
61 } else {
62 mojo_output = "$root_out_dir/" + target_name + ".mojo"
63 }
64
65 python_package(package_name) {
66 sources = invoker.sources
67 if (defined(invoker.deps)) {
68 deps = invoker.deps
69 }
70 if (defined(invoker.mojom_deps)) {
71 mojom_deps = invoker.mojom_deps
72 }
73 if (defined(invoker.datadeps)) {
74 datadeps = invoker.datadeps
75 }
76 }
77
78 action(target_name) {
79 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root)
80
81 input = package_output
82 inputs = [
83 input,
84 ]
85
86 output = mojo_output
87 outputs = [
88 output,
89 ]
90
91 deps = [
92 ":$package_name",
93 ]
94 if (defined(invoker.deps)) {
95 deps += invoker.deps
96 }
97 if (defined(invoker.mojom_deps)) {
98 deps += invoker.mojom_deps
99 }
100 if (defined(invoker.datadeps)) {
101 datadeps = invoker.datadeps
102 }
103
104 rebase_input = rebase_path(input, root_build_dir)
105 rebase_output = rebase_path(output, root_build_dir)
106 args = [
107 "--input=$rebase_input",
108 "--output=$rebase_output",
109 "--line=#!mojo mojo:py_content_handler",
110 ]
111 }
112 }
OLDNEW
« no previous file with comments | « mojo/public/python/mojo_bindings/reflection.py ('k') | mojo/public/python/src/common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698