summaryrefslogtreecommitdiff
path: root/python-nod.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-nod.spec')
-rw-r--r--python-nod.spec221
1 files changed, 221 insertions, 0 deletions
diff --git a/python-nod.spec b/python-nod.spec
new file mode 100644
index 0000000..42c933e
--- /dev/null
+++ b/python-nod.spec
@@ -0,0 +1,221 @@
+%global _empty_manifest_terminate_build 0
+Name: python-nod
+Version: 1.9.0
+Release: 1
+Summary: Python bindings for the nod library.
+License: License :: OSI Approved :: MIT License
+URL: https://github.com/henriquegemignani/py-nod
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/20/47/ec5074ac42c9d743d8a611cb586d1e5bda7e6d8859b50d4c788f9eee2c62/nod-1.9.0.tar.gz
+
+
+%description
+# py-nod
+Python 3.6 bindings for the [NOD](https://gitlab.axiodl.com/AxioDL/nod), a library for traversing, dumping, and authoring
+GameCube and Wii optical disc images.
+
+
+## Usage
+
+### Unpacking
+```python
+import nod
+
+def progress_callback(path, progress):
+ if args.verbose:
+ print("Extraction {:.0%} Complete; Current node: {}".format(progress, path))
+
+context = nod.ExtractionContext()
+context.set_progress_callback(progress_callback)
+
+try:
+ disc, is_wii = nod.open_disc_from_image("game.iso")
+ data_partition = disc.get_data_partition()
+ if not data_partition:
+ raise RuntimeError("Could not find a data partition in the disc.")
+ data_partition.extract_to_directory("dir_out", context)
+except RuntimeError as e:
+ raise Exception("Could not extract disc at 'game.iso' to 'dir_out': {}".format(e))
+
+```
+
+### Packing
+
+```python
+import nod
+
+if nod.DiscBuilderGCN.calculate_total_size_required("dir_out") is None:
+ raise Exception("Image built with given directory would pass the maximum size.")
+
+def fprogress_callback(progress: float, name: str, bytes: int):
+ print("\r" + " " * 100, end="")
+ print("\r{:.0%} {} {} B".format(progress, name, bytes), flush=True)
+
+disc_builder = nod.DiscBuilderGCN("game.iso", fprogress_callback)
+try:
+ disc_builder.build_from_directory("dir_out")
+except RuntimeError as e:
+ raise Exception("Failure building the image: {}".format(e))
+
+
+```
+
+
+%package -n python3-nod
+Summary: Python bindings for the nod library.
+Provides: python-nod
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-cffi
+BuildRequires: gcc
+BuildRequires: gdb
+%description -n python3-nod
+# py-nod
+Python 3.6 bindings for the [NOD](https://gitlab.axiodl.com/AxioDL/nod), a library for traversing, dumping, and authoring
+GameCube and Wii optical disc images.
+
+
+## Usage
+
+### Unpacking
+```python
+import nod
+
+def progress_callback(path, progress):
+ if args.verbose:
+ print("Extraction {:.0%} Complete; Current node: {}".format(progress, path))
+
+context = nod.ExtractionContext()
+context.set_progress_callback(progress_callback)
+
+try:
+ disc, is_wii = nod.open_disc_from_image("game.iso")
+ data_partition = disc.get_data_partition()
+ if not data_partition:
+ raise RuntimeError("Could not find a data partition in the disc.")
+ data_partition.extract_to_directory("dir_out", context)
+except RuntimeError as e:
+ raise Exception("Could not extract disc at 'game.iso' to 'dir_out': {}".format(e))
+
+```
+
+### Packing
+
+```python
+import nod
+
+if nod.DiscBuilderGCN.calculate_total_size_required("dir_out") is None:
+ raise Exception("Image built with given directory would pass the maximum size.")
+
+def fprogress_callback(progress: float, name: str, bytes: int):
+ print("\r" + " " * 100, end="")
+ print("\r{:.0%} {} {} B".format(progress, name, bytes), flush=True)
+
+disc_builder = nod.DiscBuilderGCN("game.iso", fprogress_callback)
+try:
+ disc_builder.build_from_directory("dir_out")
+except RuntimeError as e:
+ raise Exception("Failure building the image: {}".format(e))
+
+
+```
+
+
+%package help
+Summary: Development documents and examples for nod
+Provides: python3-nod-doc
+%description help
+# py-nod
+Python 3.6 bindings for the [NOD](https://gitlab.axiodl.com/AxioDL/nod), a library for traversing, dumping, and authoring
+GameCube and Wii optical disc images.
+
+
+## Usage
+
+### Unpacking
+```python
+import nod
+
+def progress_callback(path, progress):
+ if args.verbose:
+ print("Extraction {:.0%} Complete; Current node: {}".format(progress, path))
+
+context = nod.ExtractionContext()
+context.set_progress_callback(progress_callback)
+
+try:
+ disc, is_wii = nod.open_disc_from_image("game.iso")
+ data_partition = disc.get_data_partition()
+ if not data_partition:
+ raise RuntimeError("Could not find a data partition in the disc.")
+ data_partition.extract_to_directory("dir_out", context)
+except RuntimeError as e:
+ raise Exception("Could not extract disc at 'game.iso' to 'dir_out': {}".format(e))
+
+```
+
+### Packing
+
+```python
+import nod
+
+if nod.DiscBuilderGCN.calculate_total_size_required("dir_out") is None:
+ raise Exception("Image built with given directory would pass the maximum size.")
+
+def fprogress_callback(progress: float, name: str, bytes: int):
+ print("\r" + " " * 100, end="")
+ print("\r{:.0%} {} {} B".format(progress, name, bytes), flush=True)
+
+disc_builder = nod.DiscBuilderGCN("game.iso", fprogress_callback)
+try:
+ disc_builder.build_from_directory("dir_out")
+except RuntimeError as e:
+ raise Exception("Failure building the image: {}".format(e))
+
+
+```
+
+
+%prep
+%autosetup -n nod-1.9.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-nod -f filelist.lst
+%dir %{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 1.9.0-1
+- Package Spec generated