Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/autopkg/autopkg into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcspadden committed Aug 14, 2023
2 parents 49b88e7 + aa60c00 commit 8edcf6e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
3 changes: 1 addition & 2 deletions Code/autopkglib/StopProcessingIf.py
Expand Up @@ -15,8 +15,7 @@
# limitations under the License.
"""See docstring for StopProcessingIf class"""

from autopkglib import Processor, ProcessorError
from autopkglib import log
from autopkglib import Processor, ProcessorError, log

try:
from Foundation import NSPredicate
Expand Down
2 changes: 1 addition & 1 deletion Code/autopkglib/URLDownloader.py
Expand Up @@ -20,8 +20,8 @@
import platform
import tempfile

from autopkglib.common import BUNDLE_ID
from autopkglib import ProcessorError, xattr
from autopkglib.common import BUNDLE_ID
from autopkglib.URLGetter import URLGetter

__all__ = ["URLDownloader"]
Expand Down
6 changes: 4 additions & 2 deletions Code/autopkglib/__init__.py
Expand Up @@ -30,9 +30,9 @@
import pkg_resources
import yaml
from autopkglib.common import (
DEFAULT_RECIPE_MAP,
DEFAULT_SEARCH_DIRS,
DEFAULT_USER_OVERRIDES_DIR,
DEFAULT_RECIPE_MAP,
RE_KEYREF,
RECIPE_EXTS,
FileOrPath,
Expand Down Expand Up @@ -1007,7 +1007,9 @@ def import_processors() -> None:
#
# from Bar.Foo import Foo
#
for name in filter(lambda f: f not in ("__init__", "xattr", "prefs", "common"), processor_files):
for name in filter(
lambda f: f not in ("__init__", "xattr", "prefs", "common"), processor_files
):
globals()[name] = getattr(
__import__(__name__ + "." + name, fromlist=[name]), name
)
Expand Down
25 changes: 18 additions & 7 deletions Code/autopkglib/common.py
Expand Up @@ -19,17 +19,28 @@
import sys
from typing import IO, Any, Dict, Union


APP_NAME = "Autopkg"
BUNDLE_ID = "com.github.autopkg"
DEFAULT_USER_LIBRARY_DIR = "~/Library/AutoPkg"
DEFAULT_LIBRARY_DIR = "/Library/AutoPkg"
DEFAULT_USER_OVERRIDES_DIR = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "RecipeOverrides"))
DEFAULT_USER_RECIPES_DIR = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "Recipes"))
DEFAULT_USER_CACHE_DIR = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "Cache"))
DEFAULT_USER_REPOS_DIR = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "RecipeRepos"))
DEFAULT_RECIPE_MAP = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "recipe_map.json"))
DEFAULT_GH_TOKEN = os.path.expanduser(os.path.join(DEFAULT_USER_LIBRARY_DIR, "gh_token"))
DEFAULT_USER_OVERRIDES_DIR = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "RecipeOverrides")
)
DEFAULT_USER_RECIPES_DIR = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "Recipes")
)
DEFAULT_USER_CACHE_DIR = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "Cache")
)
DEFAULT_USER_REPOS_DIR = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "RecipeRepos")
)
DEFAULT_RECIPE_MAP = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "recipe_map.json")
)
DEFAULT_GH_TOKEN = os.path.expanduser(
os.path.join(DEFAULT_USER_LIBRARY_DIR, "gh_token")
)
DEFAULT_SEARCH_DIRS = [".", DEFAULT_USER_LIBRARY_DIR, DEFAULT_LIBRARY_DIR]

RE_KEYREF = re.compile(r"%(?P<key>[a-zA-Z_][a-zA-Z_0-9]*)%")
Expand Down
8 changes: 6 additions & 2 deletions Code/tests/test_preferences.py
Expand Up @@ -55,8 +55,12 @@ def setUp(self):
# Return an empty list of preference keys by default. Makes a new list on
# every call to ensure no false sharing.
self.mock_copykeylist.side_effect = lambda *_, **_kw: list()
self.mock_copyappvalue = patch("autopkglib.prefs.CFPreferencesCopyAppValue").start()
self.mock_setappvalue = patch("autopkglib.prefs.CFPreferencesSetAppValue").start()
self.mock_copyappvalue = patch(
"autopkglib.prefs.CFPreferencesCopyAppValue"
).start()
self.mock_setappvalue = patch(
"autopkglib.prefs.CFPreferencesSetAppValue"
).start()
self.mock_appsynchronize = patch(
"autopkglib.prefs.CFPreferencesAppSynchronize"
).start()
Expand Down

0 comments on commit 8edcf6e

Please sign in to comment.