-
Notifications
You must be signed in to change notification settings - Fork 947
Add support for glob pattern in application config files #1807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jneuendorf
wants to merge
18
commits into
lra:master
Choose a base branch
from
jneuendorf:enable_glob
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4f7a562
Added enable_glob option
semkagtn 00bc400
Added traktor application as example that using enable_glob option
semkagtn fd91ef9
enable_glob: fixed formatting
semkagtn 98df745
Merge remote-tracking branch 'base/master' into enable_glob
jneuendorf 5c490d9
enable glob patterns for configuration files, tests
jneuendorf acc8896
update changelog
jneuendorf dddb822
re-support python 2.7, remove traktor app
jneuendorf 135f837
support python 2.7, lint
jneuendorf 5089f44
fix pipeline
jneuendorf 5368476
lint, ascii config for python 2.7
jneuendorf 8db489b
fix python 2 unicode
jneuendorf 4aa356b
..
jneuendorf 8c571fb
..
jneuendorf eb98610
enhance makefile
jneuendorf bdb8142
update tests readme
jneuendorf 7f0dd9c
Merge remote-tracking branch 'base/master' into enable_glob
jneuendorf 9ea6b88
adjust makefile phony targets
jneuendorf eecb479
fix typo
jneuendorf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [application] | ||
| name = Traktor | ||
|
|
||
| [options] | ||
| enable_glob = true | ||
|
|
||
| [configuration_files] | ||
| Documents/Native Instruments/Traktor *.*.*/Traktor Settings.tsi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import os | ||
| import tempfile | ||
| import unittest | ||
| from unittest.mock import patch | ||
| import stat | ||
|
|
||
| from mackup import utils | ||
| from mackup.appsdb import ApplicationsDatabase | ||
|
|
||
|
|
||
| realpath = os.path.dirname(os.path.realpath(__file__)) | ||
| APPLICATIONS_DIR = os.path.join(realpath, "..", "mackup", "applications") | ||
| FIXTURES_DIR = os.path.join(realpath, "fixtures") | ||
|
|
||
|
|
||
| class TestMackup(unittest.TestCase): | ||
| config_file_path = os.path.join(APPLICATIONS_DIR, "test-app.cfg") | ||
|
|
||
| def setUp(self): | ||
| os.environ["HOME"] = FIXTURES_DIR | ||
|
|
||
| with open(self.config_file_path, "w") as config_file: | ||
| config_file.write( | ||
| "\n".join( | ||
| [ | ||
| "[application]", | ||
| "name = Test App", | ||
| "", | ||
| "[options]", | ||
| "enable_glob = true", | ||
| "", | ||
| "[configuration_files]", | ||
| "Library/Application Support/Test App/*/data.txt", | ||
| ] | ||
| ) | ||
| ) | ||
|
|
||
| def tearDown(self): | ||
| os.remove(self.config_file_path) | ||
|
|
||
| def test_glob_configuration_paths(self): | ||
| with patch.object( | ||
| ApplicationsDatabase, | ||
| "get_config_files", | ||
| return_value=[self.config_file_path], | ||
| ) as method: | ||
| app_db = ApplicationsDatabase() | ||
| print(app_db.apps) | ||
|
|
||
| self.assertEqual( | ||
| app_db.get_files("test-app"), | ||
| { | ||
| "Library/Application Support/Test App/2020/data.txt", | ||
| "Library/Application Support/Test App/2021/data.txt", | ||
| "Library/Application Support/Test App/2022/data.txt", | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/fixtures/Library/Application Support/Test App/2020/data.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2020 |
1 change: 1 addition & 0 deletions
1
tests/fixtures/Library/Application Support/Test App/2021/data.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2021 |
1 change: 1 addition & 0 deletions
1
tests/fixtures/Library/Application Support/Test App/2022/data.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2022 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.