diff --git a/MANIFEST.in b/MANIFEST.in index 5ded421c..08d9b5d5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include src/c2pa/libs/*.dylib include src/c2pa/libs/*.dll -include src/c2pa/libs/*.so \ No newline at end of file +include src/c2pa/libs/*.so \ No newline at end of file diff --git a/Makefile b/Makefile index 809aa7ec..2938e3d5 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ build-python: python3 -m pip uninstall -y maturin python3 -m pip install -r requirements.txt + python3 -m pip install -r requirements-dev.txt pip install -e . test: python3 ./tests/test_unit_tests.py - python3 ./tests/test_api.py publish: release python3 -m pip install twine diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..31f36529 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,9 @@ +# Build dependencies +wheel==0.41.2 # For building wheels +setuptools==68.0.0 # For building packages + +# Testing dependencies +pytest==7.4.0 + +# for downloading the library artifacts +requests>=2.0.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 6f937501..596f3d8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,2 @@ - -wheel==0.41.2 # For building wheels -setuptools==68.0.0 # For building packages -# Testing dependencies -pytest==7.4.0 - # only used in the training example -cryptography>=41.0.0 -# for downloading the library artifacts -requests>=2.0.0 \ No newline at end of file +# only used in the training example +cryptography>=41.0.0 \ No newline at end of file diff --git a/src/c2pa/build.py b/src/c2pa/build.py index 2a252925..106dab9c 100644 --- a/src/c2pa/build.py +++ b/src/c2pa/build.py @@ -23,20 +23,20 @@ def get_latest_release() -> dict: def download_artifact(url: str, platform_name: str) -> None: """Download and extract an artifact to the appropriate platform directory.""" print(f"Downloading artifact for {platform_name}...") - + # Create platform directory platform_dir = ARTIFACTS_DIR / platform_name platform_dir.mkdir(parents=True, exist_ok=True) - + # Download the zip file response = requests.get(url) response.raise_for_status() - + # Extract the zip file with zipfile.ZipFile(io.BytesIO(response.content)) as zip_ref: # Extract all files to the platform directory zip_ref.extractall(platform_dir) - + print(f"Successfully downloaded and extracted artifacts for {platform_name}") def download_artifacts() -> None: @@ -44,27 +44,27 @@ def download_artifacts() -> None: try: # Create artifacts directory if it doesn't exist ARTIFACTS_DIR.mkdir(exist_ok=True) - + # Get latest release print("Fetching latest release information...") release = get_latest_release() print(f"Found release: {release['tag_name']}") - + # Download each asset for asset in release['assets']: # Skip non-zip files if not asset['name'].endswith('.zip'): continue - + # Determine platform from asset name # Example: c2pa-rs-v1.0.0-macosx-arm64.zip platform_name = asset['name'].split('-')[-1].replace('.zip', '') - + # Download and extract the artifact download_artifact(asset['browser_download_url'], platform_name) - + print("\nAll artifacts have been downloaded successfully!") - + except requests.exceptions.RequestException as e: print(f"Error downloading artifacts: {e}", file=sys.stderr) sys.exit(1) @@ -77,4 +77,4 @@ def initialize_build() -> None: download_artifacts() if __name__ == "__main__": - download_artifacts() \ No newline at end of file + download_artifacts() \ No newline at end of file diff --git a/src/c2pa/lib.py b/src/c2pa/lib.py index 880e9238..9b4bdb64 100644 --- a/src/c2pa/lib.py +++ b/src/c2pa/lib.py @@ -83,7 +83,7 @@ def dynamically_load_library(lib_name: Optional[str] = None) -> Optional[ctypes. # Package directory Path(__file__).parent, # Additional library directory - Path(__file__).parent / "lib", + Path(__file__).parent / "libs", # System library paths *[Path(p) for p in os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep) if p], ] @@ -95,7 +95,7 @@ def dynamically_load_library(lib_name: Optional[str] = None) -> Optional[ctypes. raise RuntimeError(f"Could not find {lib_name} in any of the search paths") return lib - # Default paht (no library name provided in the environment) + # Default path (no library name provided in the environment) c2pa_lib = _load_single_library(c2pa_lib_name, possible_paths) if not c2pa_lib: raise RuntimeError(f"Could not find {c2pa_lib_name} in any of the search paths")