stac-validator 3.9.2__tar.gz → 3.9.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac_validator
3
- Version: 3.9.2
3
+ Version: 3.9.3
4
4
  Summary: A package to validate STAC files
5
5
  Home-page: https://github.com/stac-utils/stac-validator
6
6
  Author: James Banting, Jonathan Healy
@@ -26,7 +26,7 @@ License-File: LICENSE
26
26
  <img src="https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png" width=560>
27
27
  </p>
28
28
 
29
- [![Downloads](https://static.pepy.tech/badge/stac-validator?color=blue)](https://pepy.tech/project/stac-validator)
29
+ [![PyPI Downloads](https://static.pepy.tech/badge/stac-validator/month)](https://pepy.tech/projects/stac-validator)
30
30
  [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)
31
31
  [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)
32
32
  [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)
@@ -6,7 +6,7 @@
6
6
  <img src="https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png" width=560>
7
7
  </p>
8
8
 
9
- [![Downloads](https://static.pepy.tech/badge/stac-validator?color=blue)](https://pepy.tech/project/stac-validator)
9
+ [![PyPI Downloads](https://static.pepy.tech/badge/stac-validator/month)](https://pepy.tech/projects/stac-validator)
10
10
  [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)
11
11
  [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)
12
12
  [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)
@@ -2,7 +2,7 @@
2
2
 
3
3
  from setuptools import setup
4
4
 
5
- __version__ = "3.9.2"
5
+ __version__ = "3.9.3"
6
6
 
7
7
  with open("README.md", "r") as fh:
8
8
  long_description = fh.read()
@@ -618,12 +618,32 @@ class StacValidate:
618
618
  if link["rel"] in ("child", "item"):
619
619
  address = link["href"]
620
620
  if not is_valid_url(address):
621
- path_parts = str(base_url).split("/")
622
- path_parts.pop(-1)
623
- root = path_parts[0]
624
- for i in range(1, len(path_parts)):
625
- root = f"{root}/{path_parts[i]}"
626
- self.stac_file = f"{root}/{address}"
621
+ if is_valid_url(str(base_url)):
622
+ # If base is a URL, handle URL joining
623
+ from urllib.parse import urljoin
624
+
625
+ self.stac_file = urljoin(
626
+ (
627
+ str(base_url) + "/"
628
+ if not str(base_url).endswith("/")
629
+ else str(base_url)
630
+ ),
631
+ address,
632
+ )
633
+ else:
634
+ # Handle local file paths
635
+ current_dir = os.path.dirname(
636
+ os.path.abspath(str(base_url))
637
+ )
638
+ self.stac_file = os.path.normpath(
639
+ os.path.join(current_dir, address)
640
+ )
641
+ # Convert to relative path for cleaner output if it's under the current working directory
642
+ try:
643
+ self.stac_file = os.path.relpath(self.stac_file)
644
+ except ValueError:
645
+ # If paths are on different drives (Windows) or other relpath issues, use the absolute path
646
+ pass
627
647
  else:
628
648
  self.stac_file = address
629
649
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-validator
3
- Version: 3.9.2
3
+ Version: 3.9.3
4
4
  Summary: A package to validate STAC files
5
5
  Home-page: https://github.com/stac-utils/stac-validator
6
6
  Author: James Banting, Jonathan Healy
@@ -26,7 +26,7 @@ License-File: LICENSE
26
26
  <img src="https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png" width=560>
27
27
  </p>
28
28
 
29
- [![Downloads](https://static.pepy.tech/badge/stac-validator?color=blue)](https://pepy.tech/project/stac-validator)
29
+ [![PyPI Downloads](https://static.pepy.tech/badge/stac-validator/month)](https://pepy.tech/projects/stac-validator)
30
30
  [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)
31
31
  [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)
32
32
  [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)
File without changes
File without changes