iker-python-setup 1.0.13__tar.gz → 1.0.15__tar.gz

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.
Files changed (24) hide show
  1. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/.github/workflows/pr.yml +3 -0
  2. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/.github/workflows/push.yml +1 -0
  3. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/PKG-INFO +2 -2
  4. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/pyproject.toml +3 -3
  5. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker/setup/__init__.py +10 -10
  6. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/PKG-INFO +2 -2
  7. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/test/iker_tests/setup_test.py +43 -1
  8. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/.editorconfig +0 -0
  9. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/.gitignore +0 -0
  10. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/MANIFEST.in +0 -0
  11. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/README.md +0 -0
  12. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/VERSION +0 -0
  13. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/resources/unittest/setup/VERSION +0 -0
  14. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/resources/unittest/setup/VERSION_EXCESSIVE_PATCH +0 -0
  15. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/resources/unittest/setup/VERSION_NO_PATCH +0 -0
  16. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/setup.cfg +0 -0
  17. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/setup.py +0 -0
  18. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/SOURCES.txt +0 -0
  19. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/dependency_links.txt +0 -0
  20. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/not-zip-safe +0 -0
  21. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/requires.txt +0 -0
  22. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/src/iker_python_setup.egg-info/top_level.txt +0 -0
  23. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/test/iker_test.py +0 -0
  24. {iker_python_setup-1.0.13 → iker_python_setup-1.0.15}/test/iker_tests/__init__.py +0 -0
@@ -21,6 +21,7 @@ jobs:
21
21
 
22
22
  - name: Build and Test
23
23
  run: |
24
+ sudo apt-get update
24
25
  sudo apt-get install libxml2-dev libxslt1-dev llvm-14-dev
25
26
  python -m pip install --upgrade pip
26
27
  python -m pip install .[test]
@@ -39,6 +40,7 @@ jobs:
39
40
 
40
41
  - name: Build and Test
41
42
  run: |
43
+ sudo apt-get update
42
44
  sudo apt-get install libxml2-dev libxslt1-dev llvm-14-dev
43
45
  python -m pip install --upgrade pip
44
46
  python -m pip install .[test]
@@ -57,6 +59,7 @@ jobs:
57
59
 
58
60
  - name: Build and Test
59
61
  run: |
62
+ sudo apt-get update
60
63
  sudo apt-get install libxml2-dev libxslt1-dev llvm-14-dev
61
64
  python -m pip install --upgrade pip
62
65
  python -m pip install .[test]
@@ -21,6 +21,7 @@ jobs:
21
21
 
22
22
  - name: Build and Upload
23
23
  run: |
24
+ sudo apt-get update
24
25
  sudo apt-get install libxml2-dev libxslt1-dev llvm-14-dev
25
26
  python -m pip install --upgrade pip build twine
26
27
  python -m pip install .[test]
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: iker-python-setup
3
- Version: 1.0.13
3
+ Version: 1.0.15
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -37,10 +37,10 @@ where = ["src"]
37
37
  namespaces = true
38
38
 
39
39
  [tool.pytest.ini_options]
40
- pythonpath = ["test"]
40
+ pythonpath = ["src"]
41
41
 
42
42
  [tool.coverage.run]
43
+ branch = true
43
44
  include = [
44
- "src/iker/setup/*",
45
- "*/site-packages/iker/setup/*",
45
+ "src/iker/*",
46
46
  ]
@@ -1,6 +1,8 @@
1
1
  import importlib.metadata
2
2
  import os
3
3
 
4
+ import setuptools
5
+
4
6
  try:
5
7
  __version__ = importlib.metadata.version("iker-python-setup")
6
8
  except importlib.metadata.PackageNotFoundError:
@@ -44,8 +46,7 @@ def version_string_scm(cwd: str | None,
44
46
  patch_env_var: str,
45
47
  scm_branch_name: str,
46
48
  scm_branch_env_var: str) -> str:
47
- from setuptools_scm import ScmVersion
48
- from setuptools_scm import get_version
49
+ import setuptools_scm
49
50
  if cwd is None:
50
51
  cwd = os.getcwd()
51
52
 
@@ -59,23 +60,23 @@ def version_string_scm(cwd: str | None,
59
60
  raise ValueError("Cannot find SCM root properly")
60
61
  return find_scm_root(pd)
61
62
 
62
- def version_scheme_callback(scm_version: ScmVersion) -> str:
63
+ def version_scheme_callback(scm_version: setuptools_scm.ScmVersion) -> str:
63
64
  major, minor, patch = read_version_tuple(cwd, version_file=version_file, patch_env_var=patch_env_var)
64
65
  if scm_version.branch == scm_branch_name or os.getenv(scm_branch_env_var) == scm_branch_name:
65
66
  return f"{major}.{minor}.{patch}"
66
67
  return f"{major}.{minor}.{0}"
67
68
 
68
- def local_scheme_callback(scm_version: ScmVersion) -> str:
69
+ def local_scheme_callback(scm_version: setuptools_scm.ScmVersion) -> str:
69
70
  if scm_version.branch == scm_branch_name or os.getenv(scm_branch_env_var) == scm_branch_name:
70
71
  return ""
71
72
  if scm_version.dirty:
72
73
  return scm_version.format_with("+{node}.dirty")
73
74
  return scm_version.format_with("+{node}")
74
75
 
75
- return get_version(root=find_scm_root(cwd),
76
- version_scheme=version_scheme_callback,
77
- local_scheme=local_scheme_callback,
78
- normalize=True)
76
+ return setuptools_scm.get_version(root=find_scm_root(cwd),
77
+ version_scheme=version_scheme_callback,
78
+ local_scheme=local_scheme_callback,
79
+ normalize=True)
79
80
 
80
81
 
81
82
  def version_string(cwd: str | None = None,
@@ -106,5 +107,4 @@ def version_string(cwd: str | None = None,
106
107
 
107
108
 
108
109
  def setup(cwd: str | None = None, **kwargs):
109
- from setuptools import setup
110
- setup(version=version_string(cwd, **kwargs), **kwargs)
110
+ setuptools.setup(version=version_string(cwd, **kwargs), **kwargs)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: iker-python-setup
3
- Version: 1.0.13
3
+ Version: 1.0.15
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.11
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -17,6 +17,15 @@ class Test(unittest.TestCase):
17
17
  self.assertEqual(minor, 2)
18
18
  self.assertEqual(patch, 3)
19
19
 
20
+ def test_read_version_tuple__none_cwd(self):
21
+ with unittest.mock.patch("os.getcwd", return_value=os.path.join(resources_directory, "unittest/setup")):
22
+ major, minor, patch = iker.setup.read_version_tuple(None,
23
+ version_file="VERSION",
24
+ patch_env_var="DUMMY_BUILD")
25
+ self.assertEqual(major, 1)
26
+ self.assertEqual(minor, 2)
27
+ self.assertEqual(patch, 3)
28
+
20
29
  def test_read_version_tuple__excessive_patch(self):
21
30
  major, minor, patch = iker.setup.read_version_tuple(os.path.join(resources_directory, "unittest/setup"),
22
31
  version_file="VERSION_EXCESSIVE_PATCH",
@@ -92,6 +101,16 @@ class Test(unittest.TestCase):
92
101
  self.assertTrue(version_string.startswith("1.2.0"))
93
102
  self.assertTrue(re.match(r"^\d+\.\d+\.\d+(\+g[0-9a-f]{7}(\.dirty)?)?$", version_string))
94
103
 
104
+ def test_version_string_scm__none_cwd(self):
105
+ with unittest.mock.patch("os.getcwd", return_value=os.path.join(resources_directory, "unittest/setup")):
106
+ version_string = iker.setup.version_string_scm(None,
107
+ version_file="VERSION",
108
+ patch_env_var="DUMMY_BUILD",
109
+ scm_branch_name="dummy_branch",
110
+ scm_branch_env_var="DUMMY_BRANCH")
111
+ self.assertTrue(version_string.startswith("1.2.0"))
112
+ self.assertTrue(re.match(r"^\d+\.\d+\.\d+(\+g[0-9a-f]{7}(\.dirty)?)?$", version_string))
113
+
95
114
  def test_version_string_scm__env_branch(self):
96
115
  with unittest.mock.patch.dict(os.environ, {"DUMMY_BRANCH": "dummy_branch"}):
97
116
  version_string = iker.setup.version_string_scm(os.path.join(resources_directory, "unittest/setup"),
@@ -101,6 +120,17 @@ class Test(unittest.TestCase):
101
120
  scm_branch_env_var="DUMMY_BRANCH")
102
121
  self.assertEqual(version_string, "1.2.3")
103
122
 
123
+ def test_version_string_scm__scm_root_not_found(self):
124
+ with (
125
+ unittest.mock.patch("os.listdir", return_value=[]),
126
+ self.assertRaises(ValueError),
127
+ ):
128
+ iker.setup.version_string_scm(os.path.join(resources_directory, "unittest/setup"),
129
+ version_file="VERSION",
130
+ patch_env_var="DUMMY_BUILD",
131
+ scm_branch_name="dummy_branch",
132
+ scm_branch_env_var="DUMMY_BRANCH")
133
+
104
134
  def test_version_string(self):
105
135
  version_string = iker.setup.version_string(os.path.join(resources_directory, "unittest/setup"),
106
136
  version_file="VERSION",
@@ -130,7 +160,7 @@ class Test(unittest.TestCase):
130
160
 
131
161
  def test_version_string__with_exception_raised(self):
132
162
  with (
133
- (unittest.mock.patch("iker.setup.version_string_scm", side_effect=Exception())),
163
+ unittest.mock.patch("iker.setup.version_string_scm", side_effect=Exception()),
134
164
  self.assertRaises(Exception),
135
165
  ):
136
166
  iker.setup.version_string(os.path.join(resources_directory, "unittest/setup"),
@@ -139,3 +169,15 @@ class Test(unittest.TestCase):
139
169
  scm_branch_name="dummy_branch",
140
170
  scm_branch_env_var="DUMMY_BRANCH",
141
171
  strict=True)
172
+
173
+ def test_version_string__default_fallback(self):
174
+ with (
175
+ unittest.mock.patch("iker.setup.version_string_scm", side_effect=Exception()),
176
+ unittest.mock.patch("iker.setup.version_string_local", side_effect=Exception()),
177
+ ):
178
+ version_string = iker.setup.version_string(os.path.join(resources_directory, "unittest/setup"),
179
+ version_file="VERSION",
180
+ patch_env_var="DUMMY_BUILD",
181
+ scm_branch_name="dummy_branch",
182
+ scm_branch_env_var="DUMMY_BRANCH")
183
+ self.assertEqual(version_string, "0.0.0")