procure 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
procure/__about__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = '0.1.0'
procure/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .solution import GitSolution
@@ -0,0 +1,36 @@
1
+ import os
2
+ import importlib.util
3
+ from pathlib import Path
4
+
5
+ import click
6
+
7
+
8
+ @click.group(invoke_without_command=True)
9
+ @click.pass_context
10
+ def cli(ctx):
11
+ ctx.ensure_object(dict)
12
+ if ctx.invoked_subcommand is None:
13
+ update()
14
+
15
+
16
+ @cli.command()
17
+ @click.pass_context
18
+ def update(ctx):
19
+ #print('update')
20
+ global dot_procure
21
+ path = Path(os.getcwd(), '.procure', '__init__.py')
22
+ if os.path.exists(path):
23
+ spec = importlib.util.spec_from_file_location(
24
+ "dot_procure", path
25
+ )
26
+ dot_procure = importlib.util.module_from_spec(spec)
27
+ spec.loader.exec_module(dot_procure)
28
+ else:
29
+ raise FileNotFoundError(f'{path} does not exist!')
30
+
31
+ solutions = dot_procure.solutions
32
+
33
+ for cls in solutions:
34
+ solution = cls()
35
+ print(f"Procuring: {cls.__name__}")
36
+ solution.update()
procure/project.py ADDED
@@ -0,0 +1,5 @@
1
+ from .resource import Resource
2
+
3
+ class Project(Resource):
4
+ def update(self):
5
+ pass
procure/resource.py ADDED
@@ -0,0 +1,3 @@
1
+ class Resource:
2
+ def update(self):
3
+ pass
procure/solution.py ADDED
@@ -0,0 +1,34 @@
1
+ import subprocess
2
+ from pathlib import Path
3
+
4
+ from .project import Project
5
+
6
+
7
+ class Solution(Project):
8
+ def update(self):
9
+ pass
10
+
11
+
12
+ class GitSolution(Solution):
13
+ path = ""
14
+ url = ""
15
+ branch = ""
16
+
17
+ def update(self):
18
+ path = Path(self.path)
19
+ if not path.exists():
20
+ self.clone()
21
+ else:
22
+ self.pull()
23
+
24
+ def clone(self):
25
+ args = ["git", "clone"]
26
+ if self.branch:
27
+ args = args + ["-b", self.branch]
28
+ args = args + [self.url, self.path]
29
+ subprocess.run(args)
30
+
31
+ def pull(self):
32
+ path = Path(self.path)
33
+ args = ["git", f"--git-dir={path / '.git'}", f"--work-tree={path}", "pull"]
34
+ subprocess.run(args)
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.1
2
+ Name: procure
3
+ Version: 0.1.0
4
+ Summary: Procure build assets
5
+ Project-URL: homepage, https://github.com/crungelab/procure
6
+ Project-URL: documentation, https://crungelab.github.io/procure/
7
+ Project-URL: repository, https://github.com/crungelab/procure
8
+ Project-URL: changelog, https://github.com/crungelab/procure/blob/main/CHANGELOG.md
9
+ Author-email: Kurtis Fields <kurtisfields@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2022 Kurtis Fields
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Programming Language :: Python
34
+ Classifier: Programming Language :: Python :: 3.8
35
+ Classifier: Programming Language :: Python :: 3.9
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: Implementation :: CPython
39
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
40
+ Requires-Python: >=3.8
41
+ Requires-Dist: click==8.1.3
42
+ Provides-Extra: dev
43
+ Requires-Dist: black~=22.12.0; extra == 'dev'
44
+ Provides-Extra: test
45
+ Requires-Dist: pytest~=7.2.1; extra == 'test'
46
+ Description-Content-Type: text/markdown
47
+
48
+ # Procure :pinched_fingers:
49
+
50
+ Python utility for procuring git repositories etc ...
@@ -0,0 +1,11 @@
1
+ procure/__about__.py,sha256=L6zbQIZKsAP-Knhm6fBcQFPoVdIDuejxze60qX23jiw,21
2
+ procure/__init__.py,sha256=0etPuFqvhI6q52N3VWyiQgwaSg8pFdcjrF7Sng3eH9Y,33
3
+ procure/project.py,sha256=fxDqzrlO6dzuf9-PAqJ5-Ok8tfpNgVGmn-fivi8KWbY,97
4
+ procure/resource.py,sha256=TEpjS_3RHbIFn46dp8cbcFDYJ2IYRNCvHKuQLUgxwWw,54
5
+ procure/solution.py,sha256=efoB52po3ZYQRkdszGNN3Y3L_xukI_sUafwQLxFqFzU,752
6
+ procure/cli/__init__.py,sha256=E_ThQw3gwHIt7L-uV5SrFBMnDwGdJ4KSvC3oVnxAPtE,885
7
+ procure-0.1.0.dist-info/METADATA,sha256=hzYKUYMxf-es_GRbrgbGMAv58R-SPA3_PHaqcoDnrMc,2402
8
+ procure-0.1.0.dist-info/WHEEL,sha256=EI2JsGydwUL5GP9t6kzZv7G3HDPi7FuZDDf9In6amRM,87
9
+ procure-0.1.0.dist-info/entry_points.txt,sha256=JyNfRC0HnQefcG97WjEdNHXgGJtDFoWCCK5S-TMQmwc,44
10
+ procure-0.1.0.dist-info/licenses/LICENSE,sha256=Yg_GlIov9Zg2uR_OskJg-wsUmuaky01UgSVd0D1Gj8s,1089
11
+ procure-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.14.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ procure = procure.cli:cli
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Kurtis Fields
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.