Delete empty mojo python package, and prefix all python packages with mojo_
R=qsr@chromium.org, qsr
Review URL: https://codereview.chromium.org/843523002
diff --git a/mojo/public/python/BUILD.gn b/mojo/public/python/BUILD.gn
index 6c396be..6178f05 100644
--- a/mojo/public/python/BUILD.gn
+++ b/mojo/public/python/BUILD.gn
@@ -6,16 +6,15 @@
group("python") {
deps = [
- ":base",
":bindings",
- ":system",
- ":system_impl",
+ ":mojo_system",
+ ":mojo_system_impl",
]
}
# GYP version: mojo.gyp:mojo_python_system
-python_binary_module("system") {
- python_base_module = "mojo"
+python_binary_module("mojo_system") {
+ python_base_module = ""
configs = [ "../build/config:mojo_sdk" ]
deps = [
":system_embedded",
@@ -24,15 +23,14 @@
python_binary_source_set("system_embedded") {
cython_sources = [
- "mojo/c_async_waiter.pxd",
- "mojo/c_core.pxd",
- "mojo/c_export.pxd",
- "mojo/c_thunks.pxd",
- "mojo/system.pyx",
+ "c_async_waiter.pxd",
+ "c_core.pxd",
+ "c_export.pxd",
+ "c_thunks.pxd",
+ "mojo_system.pyx",
]
configs = [ "../build/config:mojo_sdk" ]
deps = [
- ":base",
"../c/system",
"../cpp/bindings:callback",
"../cpp/system",
@@ -41,13 +39,13 @@
]
}
-python_binary_module("system_impl") {
- python_base_module = "mojo"
+python_binary_module("mojo_system_impl") {
+ python_base_module = ""
cython_sources = [
- "mojo/c_environment.pxd",
- "mojo/c_export.pxd",
- "mojo/c_thunks.pxd",
- "mojo/system_impl.pyx",
+ "c_environment.pxd",
+ "c_export.pxd",
+ "c_thunks.pxd",
+ "mojo_system_impl.pyx",
]
sources = [
"src/python_system_helper.cc",
@@ -55,7 +53,6 @@
]
configs = [ "../build/config:mojo_sdk" ]
deps = [
- ":base",
":python_common",
"../c/environment",
"../c/system",
@@ -82,30 +79,20 @@
]
}
-copy("base") {
- sources = [
- "mojo/__init__.py",
- ]
- outputs = [
- "$root_out_dir/python/mojo/{{source_file_part}}",
- ]
-}
-
# GYP version: mojo.gyp:mojo_python_bindings
copy("bindings") {
sources = [
- "mojo/bindings/__init__.py",
- "mojo/bindings/descriptor.py",
- "mojo/bindings/messaging.py",
- "mojo/bindings/promise.py",
- "mojo/bindings/reflection.py",
- "mojo/bindings/serialization.py",
+ "mojo_bindings/__init__.py",
+ "mojo_bindings/descriptor.py",
+ "mojo_bindings/messaging.py",
+ "mojo_bindings/promise.py",
+ "mojo_bindings/reflection.py",
+ "mojo_bindings/serialization.py",
]
outputs = [
- "$root_out_dir/python/mojo/bindings/{{source_file_part}}",
+ "$root_out_dir/python/mojo_bindings/{{source_file_part}}",
]
deps = [
- ":base",
- ":system",
+ ":mojo_system",
]
}
diff --git a/mojo/public/python/mojo/c_async_waiter.pxd b/mojo/public/python/c_async_waiter.pxd
similarity index 100%
rename from mojo/public/python/mojo/c_async_waiter.pxd
rename to mojo/public/python/c_async_waiter.pxd
diff --git a/mojo/public/python/mojo/c_core.pxd b/mojo/public/python/c_core.pxd
similarity index 100%
rename from mojo/public/python/mojo/c_core.pxd
rename to mojo/public/python/c_core.pxd
diff --git a/mojo/public/python/mojo/c_environment.pxd b/mojo/public/python/c_environment.pxd
similarity index 100%
rename from mojo/public/python/mojo/c_environment.pxd
rename to mojo/public/python/c_environment.pxd
diff --git a/mojo/public/python/mojo/c_export.pxd b/mojo/public/python/c_export.pxd
similarity index 100%
rename from mojo/public/python/mojo/c_export.pxd
rename to mojo/public/python/c_export.pxd
diff --git a/mojo/public/python/mojo/c_thunks.pxd b/mojo/public/python/c_thunks.pxd
similarity index 100%
rename from mojo/public/python/mojo/c_thunks.pxd
rename to mojo/public/python/c_thunks.pxd
diff --git a/mojo/public/python/mojo/__init__.py b/mojo/public/python/mojo/__init__.py
deleted file mode 100644
index 4d6aabb..0000000
--- a/mojo/public/python/mojo/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
diff --git a/mojo/public/python/mojo/bindings/__init__.py b/mojo/public/python/mojo_bindings/__init__.py
similarity index 100%
rename from mojo/public/python/mojo/bindings/__init__.py
rename to mojo/public/python/mojo_bindings/__init__.py
diff --git a/mojo/public/python/mojo/bindings/descriptor.py b/mojo/public/python/mojo_bindings/descriptor.py
similarity index 97%
rename from mojo/public/python/mojo/bindings/descriptor.py
rename to mojo/public/python/mojo_bindings/descriptor.py
index 0df0bd6..45e073f 100644
--- a/mojo/public/python/mojo/bindings/descriptor.py
+++ b/mojo/public/python/mojo_bindings/descriptor.py
@@ -10,11 +10,11 @@
import itertools
import struct
-import mojo.bindings.reflection as reflection
-import mojo.bindings.serialization as serialization
+import mojo_bindings.reflection as reflection
+import mojo_bindings.serialization as serialization
# pylint: disable=E0611,F0401
-import mojo.system
+import mojo_system
class Type(object):
@@ -240,7 +240,7 @@
if not self.nullable:
raise serialization.DeserializationException(
'Trying to deserialize null for non nullable type.')
- return self.FromHandle(mojo.system.Handle())
+ return self.FromHandle(mojo_system.Handle())
return self.FromHandle(context.ClaimHandle(value))
def FromHandle(self, handle):
@@ -255,8 +255,8 @@
def Convert(self, value):
if value is None:
- return mojo.system.Handle()
- if not isinstance(value, mojo.system.Handle):
+ return mojo_system.Handle()
+ if not isinstance(value, mojo_system.Handle):
raise TypeError('%r is not a handle' % value)
return value
@@ -272,7 +272,7 @@
def Convert(self, value):
if value is None:
- return reflection.InterfaceRequest(mojo.system.Handle())
+ return reflection.InterfaceRequest(mojo_system.Handle())
if not isinstance(value, reflection.InterfaceRequest):
raise TypeError('%r is not an interface request' % value)
return value
@@ -310,10 +310,10 @@
def ToHandle(self, value):
if not value:
- return mojo.system.Handle()
+ return mojo_system.Handle()
if isinstance(value, reflection.InterfaceProxy):
return value.manager.PassMessagePipe()
- pipe = mojo.system.MessagePipe()
+ pipe = mojo_system.MessagePipe()
self.interface.manager.Bind(value, pipe.handle0)
return pipe.handle1
diff --git a/mojo/public/python/mojo/bindings/messaging.py b/mojo/public/python/mojo_bindings/messaging.py
similarity index 99%
rename from mojo/public/python/mojo/bindings/messaging.py
rename to mojo/public/python/mojo_bindings/messaging.py
index c1d54fc..385a080 100644
--- a/mojo/public/python/mojo/bindings/messaging.py
+++ b/mojo/public/python/mojo_bindings/messaging.py
@@ -9,10 +9,10 @@
import sys
import weakref
-import mojo.bindings.serialization as serialization
+import mojo_bindings.serialization as serialization
# pylint: disable=E0611,F0401
-import mojo.system as system
+import mojo_system as system
# The flag values for a message header.
diff --git a/mojo/public/python/mojo/bindings/promise.py b/mojo/public/python/mojo_bindings/promise.py
similarity index 100%
rename from mojo/public/python/mojo/bindings/promise.py
rename to mojo/public/python/mojo_bindings/promise.py
diff --git a/mojo/public/python/mojo/bindings/reflection.py b/mojo/public/python/mojo_bindings/reflection.py
similarity index 98%
rename from mojo/public/python/mojo/bindings/reflection.py
rename to mojo/public/python/mojo_bindings/reflection.py
index 9668c2a..5432691 100644
--- a/mojo/public/python/mojo/bindings/reflection.py
+++ b/mojo/public/python/mojo_bindings/reflection.py
@@ -9,9 +9,9 @@
import sys
# pylint: disable=F0401
-import mojo.bindings.messaging as messaging
-import mojo.bindings.promise as promise
-import mojo.bindings.serialization as serialization
+import mojo_bindings.messaging as messaging
+import mojo_bindings.promise as promise
+import mojo_bindings.serialization as serialization
class MojoEnumType(type):
diff --git a/mojo/public/python/mojo/bindings/serialization.py b/mojo/public/python/mojo_bindings/serialization.py
similarity index 100%
rename from mojo/public/python/mojo/bindings/serialization.py
rename to mojo/public/python/mojo_bindings/serialization.py
diff --git a/mojo/public/python/mojo/system.pyx b/mojo/public/python/mojo_system.pyx
similarity index 99%
rename from mojo/public/python/mojo/system.pyx
rename to mojo/public/python/mojo_system.pyx
index 2533bab..4e684af 100644
--- a/mojo/public/python/mojo/system.pyx
+++ b/mojo/public/python/mojo_system.pyx
@@ -22,7 +22,7 @@
import ctypes
import threading
-import mojo.system_impl
+import mojo_system_impl
def SetSystemThunks(system_thunks_as_object):
"""Bind the basic Mojo Core functions.
@@ -769,7 +769,7 @@
"""RunLoop to use when using asynchronous operations on handles."""
def __init__(self):
- self.__run_loop = mojo.system_impl.RunLoop()
+ self.__run_loop = mojo_system_impl.RunLoop()
_RUN_LOOPS.loop = id(self)
def __del__(self):
@@ -801,4 +801,4 @@
return None
-_ASYNC_WAITER = mojo.system_impl.AsyncWaiter()
+_ASYNC_WAITER = mojo_system_impl.AsyncWaiter()
diff --git a/mojo/public/python/mojo/system_impl.pyx b/mojo/public/python/mojo_system_impl.pyx
similarity index 100%
rename from mojo/public/python/mojo/system_impl.pyx
rename to mojo/public/python/mojo_system_impl.pyx
diff --git a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
index 9560c29..9f2f3dc 100644
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
@@ -4,8 +4,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import mojo.bindings.descriptor as _descriptor
-import mojo.bindings.reflection as _reflection
+import mojo_bindings.descriptor as _descriptor
+import mojo_bindings.reflection as _reflection
{% if imports %}
{% for import in imports %}
diff --git a/mojo/python/BUILD.gn b/mojo/python/BUILD.gn
index 3c71480..fd66951 100644
--- a/mojo/python/BUILD.gn
+++ b/mojo/python/BUILD.gn
@@ -7,36 +7,36 @@
# GYP version: mojo/mojo.gyp:mojo_python
group("python") {
deps = [
- ":embedder",
+ ":mojo_embedder",
":validation_util",
"//mojo/public/python",
]
}
# GYP version: mojo/mojo.gyp:mojo_python_embedder
-python_binary_module("embedder") {
- python_base_module = "mojo"
- cython_sources = [ "system/mojo/embedder.pyx" ]
+python_binary_module("mojo_embedder") {
+ python_base_module = ""
+ cython_sources = [ "system/mojo_embedder.pyx" ]
deps = [
"//mojo/edk/system",
]
datadeps = [
- "//mojo/public/python:system",
+ "//mojo/public/python:mojo_system",
]
}
copy("tests_module") {
sources = [
- "system/mojo/tests/__init__.py",
+ "system/mojo_tests/__init__.py",
]
outputs = [
- "$root_out_dir/python/mojo/tests/{{source_file_part}}",
+ "$root_out_dir/python/mojo_tests/{{source_file_part}}",
]
}
python_binary_module("validation_util") {
- python_base_module = "mojo/tests"
- cython_sources = [ "system/mojo/tests/validation_util.pyx" ]
+ python_base_module = "mojo_tests"
+ cython_sources = [ "system/mojo_tests/validation_util.pyx" ]
deps = [
"//mojo/public/cpp/bindings/tests:mojo_public_bindings_test_utils",
]
diff --git a/mojo/python/system/mojo/embedder.pyx b/mojo/python/system/mojo_embedder.pyx
similarity index 89%
rename from mojo/python/system/mojo/embedder.pyx
rename to mojo/python/system/mojo_embedder.pyx
index 16ff9af..75ae387 100644
--- a/mojo/python/system/mojo/embedder.pyx
+++ b/mojo/python/system/mojo_embedder.pyx
@@ -7,8 +7,8 @@
from libc.stdint cimport uintptr_t
from libcpp cimport bool
-from mojo import system
-from mojo import system_impl
+import mojo_system
+import mojo_system_impl
cdef extern from "third_party/cython/python_export.h":
pass
@@ -43,8 +43,8 @@
InitCEmbedder(scoped_ptr[PlatformSupport](
new SimplePlatformSupport()))
cdef MojoSystemThunks thunks = MojoMakeSystemThunks()
- system.SetSystemThunks(<uintptr_t>(&thunks))
- system_impl.SetSystemThunks(<uintptr_t>(&thunks))
+ mojo_system.SetSystemThunks(<uintptr_t>(&thunks))
+ mojo_system_impl.SetSystemThunks(<uintptr_t>(&thunks))
def ShutdownForTest():
return ShutdownCEmbedderForTest()
diff --git a/mojo/python/system/mojo/tests/__init__.py b/mojo/python/system/mojo_tests/__init__.py
similarity index 100%
rename from mojo/python/system/mojo/tests/__init__.py
rename to mojo/python/system/mojo_tests/__init__.py
diff --git a/mojo/python/system/mojo/tests/validation_util.pyx b/mojo/python/system/mojo_tests/validation_util.pyx
similarity index 100%
rename from mojo/python/system/mojo/tests/validation_util.pyx
rename to mojo/python/system/mojo_tests/validation_util.pyx
diff --git a/mojo/python/tests/async_wait_unittest.py b/mojo/python/tests/async_wait_unittest.py
index 71b7e75..61b0c2c 100644
--- a/mojo/python/tests/async_wait_unittest.py
+++ b/mojo/python/tests/async_wait_unittest.py
@@ -5,7 +5,7 @@
import mojo_unittest
# pylint: disable=E0611
-from mojo import system
+import mojo_system as system
class AsyncWaitTest(mojo_unittest.MojoTestCase):
diff --git a/mojo/python/tests/bindings_interface_unittest.py b/mojo/python/tests/bindings_interface_unittest.py
index 1f8dd2a..2f4a7c2 100644
--- a/mojo/python/tests/bindings_interface_unittest.py
+++ b/mojo/python/tests/bindings_interface_unittest.py
@@ -6,10 +6,9 @@
import weakref
# pylint: disable=F0401,E0611
-import mojo.system as system
-
+import mojo_bindings.promise as promise
+import mojo_system as system
import mojo_unittest
-import mojo.bindings.promise as promise
import regression_tests_mojom
import sample_factory_mojom
import sample_service_mojom
diff --git a/mojo/python/tests/bindings_serialization_deserialization_unittest.py b/mojo/python/tests/bindings_serialization_deserialization_unittest.py
index da725c0..64397c2 100644
--- a/mojo/python/tests/bindings_serialization_deserialization_unittest.py
+++ b/mojo/python/tests/bindings_serialization_deserialization_unittest.py
@@ -7,8 +7,8 @@
import mojo_unittest
# pylint: disable=E0611,F0401
-import mojo.bindings.serialization as serialization
-import mojo.system
+import mojo_bindings.serialization as serialization
+import mojo_system
# Generated files
# pylint: disable=F0401
@@ -18,7 +18,7 @@
def _NewHandle():
- return mojo.system.MessagePipe().handle0
+ return mojo_system.MessagePipe().handle0
def _NewBar():
diff --git a/mojo/python/tests/bindings_structs_unittest.py b/mojo/python/tests/bindings_structs_unittest.py
index 5a4c064..c53c1a0 100644
--- a/mojo/python/tests/bindings_structs_unittest.py
+++ b/mojo/python/tests/bindings_structs_unittest.py
@@ -6,7 +6,7 @@
import unittest
# pylint: disable=E0611,F0401
-import mojo.system
+import mojo_system
# Generated files
# pylint: disable=F0401
@@ -161,7 +161,7 @@
# Handles
foo_instance = sample_service_mojom.Foo()
foo_instance.source = None
- foo_instance.source = mojo.system.Handle()
+ foo_instance.source = mojo_system.Handle()
with self.assertRaises(TypeError):
foo_instance.source = 1
with self.assertRaises(TypeError):
diff --git a/mojo/python/tests/generation_unittest.py b/mojo/python/tests/generation_unittest.py
index eb7ac3f..4997c53 100644
--- a/mojo/python/tests/generation_unittest.py
+++ b/mojo/python/tests/generation_unittest.py
@@ -3,7 +3,7 @@
# found in the LICENSE file.
import mojo_unittest
-from mojo.bindings import reflection
+from mojo_bindings import reflection
class GenerationTest(mojo_unittest.MojoTestCase):
diff --git a/mojo/python/tests/messaging_unittest.py b/mojo/python/tests/messaging_unittest.py
index e09532f..b372f65 100644
--- a/mojo/python/tests/messaging_unittest.py
+++ b/mojo/python/tests/messaging_unittest.py
@@ -5,10 +5,10 @@
import unittest
import mojo_unittest
-from mojo.bindings import messaging
+from mojo_bindings import messaging
# pylint: disable=E0611
-from mojo import system
+import mojo_system as system
class _ForwardingConnectionErrorHandler(messaging.ConnectionErrorHandler):
diff --git a/mojo/python/tests/mojo_unittest.py b/mojo/python/tests/mojo_unittest.py
index f80ffac..fc921ac 100644
--- a/mojo/python/tests/mojo_unittest.py
+++ b/mojo/python/tests/mojo_unittest.py
@@ -5,8 +5,8 @@
import unittest
# pylint: disable=E0611,F0401
-import mojo.embedder
-import mojo.system
+import mojo_embedder
+import mojo_system
class MojoTestCase(unittest.TestCase):
@@ -16,9 +16,9 @@
def run(self, *args, **kwargs):
try:
- mojo.embedder.Init()
- self.loop = mojo.system.RunLoop()
+ mojo_embedder.Init()
+ self.loop = mojo_system.RunLoop()
unittest.TestCase.run(self, *args, **kwargs)
finally:
self.loop = None
- assert mojo.embedder.ShutdownForTest()
+ assert mojo_embedder.ShutdownForTest()
diff --git a/mojo/python/tests/promise_unittest.py b/mojo/python/tests/promise_unittest.py
index 44427ba..4f089ed 100644
--- a/mojo/python/tests/promise_unittest.py
+++ b/mojo/python/tests/promise_unittest.py
@@ -5,7 +5,7 @@
import unittest
# pylint: disable=F0401
-from mojo.bindings import promise
+from mojo_bindings import promise
class PromiseTest(unittest.TestCase):
diff --git a/mojo/python/tests/runloop_unittest.py b/mojo/python/tests/runloop_unittest.py
index 5c1ca83..c471ea9 100644
--- a/mojo/python/tests/runloop_unittest.py
+++ b/mojo/python/tests/runloop_unittest.py
@@ -5,7 +5,7 @@
import mojo_unittest
# pylint: disable=E0611
-from mojo import system
+import mojo_system as system
def _Increment(array):
diff --git a/mojo/python/tests/system_unittest.py b/mojo/python/tests/system_unittest.py
index 9501e1b..2594e22 100644
--- a/mojo/python/tests/system_unittest.py
+++ b/mojo/python/tests/system_unittest.py
@@ -8,7 +8,7 @@
import mojo_unittest
# pylint: disable=E0611
-from mojo import system
+import mojo_system as system
DATA_SIZE = 1024
diff --git a/mojo/python/tests/validation_unittest.py b/mojo/python/tests/validation_unittest.py
index 753ff52..8e48ae2 100644
--- a/mojo/python/tests/validation_unittest.py
+++ b/mojo/python/tests/validation_unittest.py
@@ -10,9 +10,9 @@
import validation_test_interfaces_mojom
# pylint: disable=E0611
-from mojo import system
-from mojo.bindings import messaging
-from mojo.tests import validation_util
+import mojo_system as system
+from mojo_bindings import messaging
+from mojo_tests import validation_util
from mopy.paths import Paths
logging.basicConfig(level=logging.ERROR)