diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-14 23:35:18 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-01 15:22:15 +0200 |
commit | 39f9ab375b2bfd9e46df9695b78870cf1e9cf3c6 (patch) | |
tree | 522ad2b33de883f03a53ffa17e4d74202bcf762a /python | |
parent | 28a3cd1028612b3b577768519d11fa6fbcda6f09 (diff) | |
download | uxp-39f9ab375b2bfd9e46df9695b78870cf1e9cf3c6.tar.gz |
Issue #1053 - Remove /dom/system/android and dependent modules,
as well as robocop.
Diffstat (limited to 'python')
-rw-r--r-- | python/compare-locales/compare_locales/checks.py | 79 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/backend/mach_commands.py | 35 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/base.py | 7 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/config_status.py | 4 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/configure/constants.py | 1 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/mach_commands.py | 61 |
6 files changed, 35 insertions, 152 deletions
diff --git a/python/compare-locales/compare_locales/checks.py b/python/compare-locales/compare_locales/checks.py index ee3bef03dd..0faffcc698 100644 --- a/python/compare-locales/compare_locales/checks.py +++ b/python/compare-locales/compare_locales/checks.py @@ -351,88 +351,9 @@ class DTDChecker(Checker): for t in self.processContent(self.texthandler.textcontent): yield t - -class PrincessAndroid(DTDChecker): - """Checker for the string values that Android puts into an XML container. - - http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling # noqa - has more info. Check for unescaped apostrophes and bad unicode escapes. - """ - quoted = re.compile("(?P<q>[\"']).*(?P=q)$") - - def unicode_escape(self, str): - """Helper method to try to decode all unicode escapes in a string. - - This code uses the standard python decode for unicode-escape, but - that's somewhat tricky, as its input needs to be ascii. To get to - ascii, the unicode string gets converted to ascii with - backslashreplace, i.e., all non-ascii unicode chars get unicode - escaped. And then we try to roll all of that back. - Now, when that hits an error, that's from the original string, and we - need to search for the actual error position in the original string, - as the backslashreplace code changes string positions quite badly. - See also the last check in TestAndroid.test_android_dtd, with a - lengthy chinese string. - """ - val = str.encode('ascii', 'backslashreplace') - try: - val.decode('unicode-escape') - except UnicodeDecodeError, e: - args = list(e.args) - badstring = args[1][args[2]:args[3]] - i = len(args[1][:args[2]].decode('unicode-escape')) - args[2] = i - args[3] = i + len(badstring) - raise UnicodeDecodeError(*args) - - @classmethod - def use(cls, file): - """Use this Checker only for DTD files in embedding/android.""" - return (file.module in ("embedding/android", - "mobile/android/base") and - cls.pattern.match(file.file)) - - def processContent(self, val): - """Actual check code. - Check for unicode escapes and unescaped quotes and apostrophes, - if string's not quoted. - """ - # first, try to decode unicode escapes - try: - self.unicode_escape(val) - except UnicodeDecodeError, e: - yield ('error', e.args[2], e.args[4], 'android') - # check for unescaped single or double quotes. - # first, see if the complete string is single or double quoted, - # that changes the rules - m = self.quoted.match(val) - if m: - q = m.group('q') - offset = 0 - val = val[1:-1] # strip quotes - else: - q = "[\"']" - offset = -1 - stray_quot = re.compile(r"[\\\\]*(%s)" % q) - - for m in stray_quot.finditer(val): - if len(m.group(0)) % 2: - # found an unescaped single or double quote, which message? - if m.group(1) == '"': - msg = u"Quotes in Android DTDs need escaping with \\\" "\ - u"or \\u0022, or put string in apostrophes." - else: - msg = u"Apostrophes in Android DTDs need escaping with "\ - u"\\' or \\u0027, or use \u2019, or put string in "\ - u"quotes." - yield ('error', m.end(0)+offset, msg, 'android') - - def getChecker(file, reference=None): if PropertiesChecker.use(file): return PropertiesChecker() - if PrincessAndroid.use(file): - return PrincessAndroid(reference) if DTDChecker.use(file): return DTDChecker(reference) return None diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py index 5608d40b11..f2448b2f44 100644 --- a/python/mozbuild/mozbuild/backend/mach_commands.py +++ b/python/mozbuild/mozbuild/backend/mach_commands.py @@ -24,16 +24,13 @@ from mach.decorators import ( class MachCommands(MachCommandBase): @Command('ide', category='devenv', description='Generate a project and launch an IDE.') - @CommandArgument('ide', choices=['eclipse', 'visualstudio', 'androidstudio', 'intellij']) + @CommandArgument('ide', choices=['eclipse', 'visualstudio', 'intellij']) @CommandArgument('args', nargs=argparse.REMAINDER) def eclipse(self, ide, args): if ide == 'eclipse': backend = 'CppEclipse' elif ide == 'visualstudio': backend = 'VisualStudio' - elif ide == 'androidstudio' or ide == 'intellij': - # The build backend for Android Studio and IntelliJ is just the regular one. - backend = 'RecursiveMake' if ide == 'eclipse': try: @@ -42,8 +39,8 @@ class MachCommands(MachCommandBase): print('Eclipse CDT 8.4 or later must be installed in your PATH.') print('Download: http://www.eclipse.org/cdt/downloads.php') return 1 - elif ide == 'androidstudio' or ide =='intellij': - studio = ['studio'] if ide == 'androidstudio' else ['idea'] + elif ide =='intellij': + studio = ['idea'] if sys.platform != 'darwin': try: which.which(studio[0]) @@ -57,7 +54,7 @@ class MachCommands(MachCommandBase): studio = ['open', '-a', d] break else: - print('Android Studio or IntelliJ IDEA 14 is not installed in /Applications.') + print('IntelliJ IDEA 14 is not installed in /Applications.') return 1 # Here we refresh the whole build. 'build export' is sufficient here and is probably more @@ -67,7 +64,7 @@ class MachCommands(MachCommandBase): if res != 0: return 1 - if ide in ('androidstudio', 'intellij'): + if ide in ('intellij'): res = self._mach_context.commands.dispatch('package', self._mach_context) if res != 0: return 1 @@ -87,7 +84,7 @@ class MachCommands(MachCommandBase): elif ide == 'visualstudio': visual_studio_workspace_dir = self.get_visualstudio_workspace_path() process = subprocess.check_call(['explorer.exe', visual_studio_workspace_dir]) - elif ide == 'androidstudio' or ide == 'intellij': + elif ide == 'intellij': gradle_dir = None if self.is_gradle_project_already_imported(): gradle_dir = self.get_gradle_project_path() @@ -103,7 +100,7 @@ class MachCommands(MachCommandBase): return os.path.join(self.topobjdir, 'msvc', 'mozilla.sln') def get_gradle_project_path(self): - return os.path.join(self.topobjdir, 'mobile', 'android', 'gradle') + return os.path.join(self.topobjdir, 'mobile', 'gradle') def get_gradle_import_path(self): return os.path.join(self.get_gradle_project_path(), 'build.gradle') @@ -114,19 +111,13 @@ class MachCommands(MachCommandBase): def get_mac_ide_preferences(self, ide): if sys.platform == 'darwin': - if ide == 'androidstudio': - return ['/Applications/Android Studio.app'] - else: - return [ - '/Applications/IntelliJ IDEA 14 EAP.app', - '/Applications/IntelliJ IDEA 14.app', - '/Applications/IntelliJ IDEA 14 CE EAP.app', - '/Applications/IntelliJ IDEA 14 CE.app'] + return [ + '/Applications/IntelliJ IDEA 14 EAP.app', + '/Applications/IntelliJ IDEA 14.app', + '/Applications/IntelliJ IDEA 14 CE EAP.app', + '/Applications/IntelliJ IDEA 14 CE.app'] def print_ide_error(self, ide): - if ide == 'androidstudio': - print('Android Studio is not installed in your PATH.') - print('You can generate a command-line launcher from Android Studio->Tools->Create Command-line launcher with script name \'studio\'') - elif ide == 'intellij': + if ide == 'intellij': print('IntelliJ is not installed in your PATH.') print('You can generate a command-line launcher from IntelliJ IDEA->Tools->Create Command-line launcher with script name \'idea\'') diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 9db1005d11..24791b6182 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -777,13 +777,6 @@ class MachCommandConditions(object): return False @staticmethod - def is_android(cls): - """Must have an Android build.""" - if hasattr(cls, 'substs'): - return cls.substs.get('MOZ_WIDGET_TOOLKIT') == 'android' - return False - - @staticmethod def is_hg(cls): """Must have a mercurial source checkout.""" if hasattr(cls, 'substs'): diff --git a/python/mozbuild/mozbuild/config_status.py b/python/mozbuild/mozbuild/config_status.py index 3557bbf778..fa15fa65bb 100644 --- a/python/mozbuild/mozbuild/config_status.py +++ b/python/mozbuild/mozbuild/config_status.py @@ -177,7 +177,3 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, if os.name == 'nt' and 'VisualStudio' not in options.backend: print(VISUAL_STUDIO_ADVERTISEMENT) - # Advertise Eclipse if it is appropriate. - if MachCommandConditions.is_android(env): - if 'AndroidEclipse' not in options.backend: - print(ANDROID_IDE_ADVERTISEMENT) diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py index 00d9ff9bbf..a7d84def00 100644 --- a/python/mozbuild/mozbuild/configure/constants.py +++ b/python/mozbuild/mozbuild/configure/constants.py @@ -16,7 +16,6 @@ CompilerType = EnumString.subclass( ) OS = EnumString.subclass( - 'Android', 'DragonFly', 'FreeBSD', 'GNU', diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index bd3fbe921f..d1a1e1393e 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -1149,9 +1149,6 @@ class Install(MachCommandBase): @CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output when installing to an Android emulator.') def install(self, verbose=False): - if conditions.is_android(self): - from mozrunner.devices.android_device import verify_android_device - verify_android_device(self, verbose=verbose) ret = self._run_make(directory=".", target='install', ensure_exit_code=False) if ret == 0: self.notify('Install complete') @@ -1205,47 +1202,33 @@ class RunProgram(MachCommandBase): def run(self, params, remote, background, noprofile, disable_e10s, debug, debugger, debugparams, slowscript, dmd, mode, stacks, show_dump_stats): - if conditions.is_android(self): - # Running Firefox for Android is completely different - if dmd: - print("DMD is not supported for Firefox for Android") - return 1 - from mozrunner.devices.android_device import verify_android_device, run_firefox_for_android - if not (debug or debugger or debugparams): - verify_android_device(self, install=True) - return run_firefox_for_android(self, params) - verify_android_device(self, install=True, debugger=True) - args = [''] - - else: - - try: - binpath = self.get_binary_path('app') - except Exception as e: - print("It looks like your program isn't built.", - "You can run |mach build| to build it.") - print(e) - return 1 + try: + binpath = self.get_binary_path('app') + except Exception as e: + print("It looks like your program isn't built.", + "You can run |mach build| to build it.") + print(e) + return 1 - args = [binpath] + args = [binpath] - if params: - args.extend(params) + if params: + args.extend(params) - if not remote: - args.append('-no-remote') + if not remote: + args.append('-no-remote') - if not background and sys.platform == 'darwin': - args.append('-foreground') + if not background and sys.platform == 'darwin': + args.append('-foreground') - no_profile_option_given = \ - all(p not in params for p in ['-profile', '--profile', '-P']) - if no_profile_option_given and not noprofile: - path = os.path.join(self.topobjdir, 'tmp', 'scratch_user') - if not os.path.isdir(path): - os.makedirs(path) - args.append('-profile') - args.append(path) + no_profile_option_given = \ + all(p not in params for p in ['-profile', '--profile', '-P']) + if no_profile_option_given and not noprofile: + path = os.path.join(self.topobjdir, 'tmp', 'scratch_user') + if not os.path.isdir(path): + os.makedirs(path) + args.append('-profile') + args.append(path) extra_env = {'MOZ_CRASHREPORTER_DISABLE': '1'} if disable_e10s: |