Bug 1279564 - Move get_state_dir() to own module; r=glandium
authorGregory Szorc <gps@mozilla.com>
Fri, 10 Jun 2016 09:33:14 -0700
changeset 302872 910bb13e5929010e0e34b6a08fd3bcf6f5657b6e
parent 302871 e45890951ce77c3df05575bd54072b9f300d77b0
child 302873 cc353a894d96e10c4d78c8d72353760c5288a0ab
push id30338
push usergszorc@mozilla.com
push dateTue, 28 Jun 2016 18:14:01 +0000
treeherderautoland@2812ef2db597 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1279564
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1279564 - Move get_state_dir() to own module; r=glandium We'll be consolidating code from mach_bootstrap.py and mozboot. We don't want mach_bootstrap.py to import bootstrap.py because it imports nearly every module under mozboot. So establish a standalone module with minimal dependencies to hold utility code. Move get_state_dir() there. MozReview-Commit-ID: Hw5VB5OZGCi
python/mozboot/mozboot/bootstrap.py
python/mozboot/mozboot/util.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -15,16 +15,19 @@ import subprocess
 from mozboot.centosfedora import CentOSFedoraBootstrapper
 from mozboot.debian import DebianBootstrapper
 from mozboot.freebsd import FreeBSDBootstrapper
 from mozboot.gentoo import GentooBootstrapper
 from mozboot.osx import OSXBootstrapper
 from mozboot.openbsd import OpenBSDBootstrapper
 from mozboot.archlinux import ArchlinuxBootstrapper
 from mozboot.windows import WindowsBootstrapper
+from mozboot.util import (
+    get_state_dir,
+)
 
 APPLICATION_CHOICE = '''
 Please choose the version of Firefox you want to build:
 %s
 
 Note: (For Firefox for Android)
 
 The Firefox for Android front-end is built using Java, the Android
@@ -132,26 +135,16 @@ DEBIAN_DISTROS = (
     'Mint',
     'LinuxMint',
     'Elementary OS',
     'Elementary',
     '"elementary OS"',
 )
 
 
-def get_state_dir():
-    """Obtain path to a directory to hold state.
-
-    This code is shared with ``mach_bootstrap.py``.
-    """
-    state_user_dir = os.path.expanduser('~/.mozbuild')
-    state_env_dir = os.environ.get('MOZBUILD_STATE_PATH')
-    return state_env_dir or state_user_dir
-
-
 class Bootstrapper(object):
     """Main class that performs system bootstrap."""
 
     def __init__(self, finished=FINISHED, choice=None, no_interactive=False,
                  hg_configure=False):
         self.instance = None
         self.finished = finished
         self.choice = choice
new file mode 100644
--- /dev/null
+++ b/python/mozboot/mozboot/util.py
@@ -0,0 +1,12 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+
+
+def get_state_dir():
+    """Obtain path to a directory to hold state."""
+    state_user_dir = os.path.expanduser('~/.mozbuild')
+    state_env_dir = os.environ.get('MOZBUILD_STATE_PATH')
+    return state_env_dir or state_user_dir