summaryrefslogtreecommitdiff
path: root/python-fixedwidth.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-fixedwidth.spec')
-rw-r--r--python-fixedwidth.spec280
1 files changed, 280 insertions, 0 deletions
diff --git a/python-fixedwidth.spec b/python-fixedwidth.spec
new file mode 100644
index 0000000..0383ae2
--- /dev/null
+++ b/python-fixedwidth.spec
@@ -0,0 +1,280 @@
+%global _empty_manifest_terminate_build 0
+Name: python-FixedWidth
+Version: 1.3
+Release: 1
+Summary: Two-way fixed-width <--> Python dict converter.
+License: BSD
+URL: https://github.com/ShawnMilo/fixedwidth
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/94/b3/a6c09d71a822d3570bcc1ec807af99052ef41d6b4606f67340f23933fc54/FixedWidth-1.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-six
+
+%description
+Easy two-way conversion between Python dictionaries and fixed-width files.
+The FixedWidth class has been used in production without modification for
+several years.
+
+This module has also proven useful for "debugging" a fixed-width spec --
+an invalid configuration reports an error that may not be obvious from
+reading the spec document.
+
+Requires a 'config' dictonary. See unit tests for full example.
+
+Small example
+
+ SAMPLE_CONFIG = {
+
+ 'first_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 1,
+ 'end_pos': 10,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'last_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 11,
+ 'end_pos': 30,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'date': {
+ 'required': True,
+ 'type': 'date',
+ 'start_pos': 31,
+ 'end_pos': 38,
+ 'alignment': 'left',
+ 'format': '%Y%m%d',
+ 'padding': ' '
+ },
+
+ 'decimal': {
+ 'required': True,
+ 'type': 'decimal',
+ 'precision': 2,
+ 'rounding': decimal.ROUND_UP,
+ 'start_pos': 38,
+ 'end_pos': 42,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ }
+
+Notes:
+
+* A field must have a start_pos and either an end_pos or a length. If both an end_pos and a length are provided, they must not conflict.
+
+* A field may not have a default value if it is required.
+
+* Supported types are string, integer, and decimal.
+
+* Alignment and padding are required.
+
+
+License: BSD
+
+
+
+
+%package -n python3-FixedWidth
+Summary: Two-way fixed-width <--> Python dict converter.
+Provides: python-FixedWidth
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-FixedWidth
+Easy two-way conversion between Python dictionaries and fixed-width files.
+The FixedWidth class has been used in production without modification for
+several years.
+
+This module has also proven useful for "debugging" a fixed-width spec --
+an invalid configuration reports an error that may not be obvious from
+reading the spec document.
+
+Requires a 'config' dictonary. See unit tests for full example.
+
+Small example
+
+ SAMPLE_CONFIG = {
+
+ 'first_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 1,
+ 'end_pos': 10,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'last_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 11,
+ 'end_pos': 30,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'date': {
+ 'required': True,
+ 'type': 'date',
+ 'start_pos': 31,
+ 'end_pos': 38,
+ 'alignment': 'left',
+ 'format': '%Y%m%d',
+ 'padding': ' '
+ },
+
+ 'decimal': {
+ 'required': True,
+ 'type': 'decimal',
+ 'precision': 2,
+ 'rounding': decimal.ROUND_UP,
+ 'start_pos': 38,
+ 'end_pos': 42,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ }
+
+Notes:
+
+* A field must have a start_pos and either an end_pos or a length. If both an end_pos and a length are provided, they must not conflict.
+
+* A field may not have a default value if it is required.
+
+* Supported types are string, integer, and decimal.
+
+* Alignment and padding are required.
+
+
+License: BSD
+
+
+
+
+%package help
+Summary: Development documents and examples for FixedWidth
+Provides: python3-FixedWidth-doc
+%description help
+Easy two-way conversion between Python dictionaries and fixed-width files.
+The FixedWidth class has been used in production without modification for
+several years.
+
+This module has also proven useful for "debugging" a fixed-width spec --
+an invalid configuration reports an error that may not be obvious from
+reading the spec document.
+
+Requires a 'config' dictonary. See unit tests for full example.
+
+Small example
+
+ SAMPLE_CONFIG = {
+
+ 'first_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 1,
+ 'end_pos': 10,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'last_name': {
+ 'required': True,
+ 'type': 'string',
+ 'start_pos': 11,
+ 'end_pos': 30,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ 'date': {
+ 'required': True,
+ 'type': 'date',
+ 'start_pos': 31,
+ 'end_pos': 38,
+ 'alignment': 'left',
+ 'format': '%Y%m%d',
+ 'padding': ' '
+ },
+
+ 'decimal': {
+ 'required': True,
+ 'type': 'decimal',
+ 'precision': 2,
+ 'rounding': decimal.ROUND_UP,
+ 'start_pos': 38,
+ 'end_pos': 42,
+ 'alignment': 'left',
+ 'padding': ' '
+ },
+
+ }
+
+Notes:
+
+* A field must have a start_pos and either an end_pos or a length. If both an end_pos and a length are provided, they must not conflict.
+
+* A field may not have a default value if it is required.
+
+* Supported types are string, integer, and decimal.
+
+* Alignment and padding are required.
+
+
+License: BSD
+
+
+
+
+%prep
+%autosetup -n FixedWidth-1.3
+
+%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-FixedWidth -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3-1
+- Package Spec generated