Browse code

python3-Js2Py: upgrade to v0.74

- New addion python3-pytz-deprecation-shim, needed by python3-tzlocal
- And some other minor fixes

Change-Id: I5df385fbe6de37cebe1c233a48f64a3b43284f07
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/c/photon/+/21500
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Shreenidhi Shedi authored on 2023/08/12 19:34:42
Showing 6 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+From 8440ff8d93b96ee78181e3382462e8e0901a3f40 Mon Sep 17 00:00:00 2001
1
+From: Shreenidhi Shedi <sshedi@vmware.com>
2
+Date: Sat, 12 Aug 2023 12:16:31 +0530
3
+Subject: [PATCH] Use fips compatible algorithm
4
+
5
+Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
6
+---
7
+ js2py/evaljs.py | 4 ++--
8
+ 1 file changed, 2 insertions(+), 2 deletions(-)
9
+
10
+diff --git a/js2py/evaljs.py b/js2py/evaljs.py
11
+index f4649c4..b310a9d 100644
12
+--- a/js2py/evaljs.py
13
+@@ -188,7 +188,7 @@ class EvalJs(object):
14
+             cache = self.__dict__['cache']
15
+         except KeyError:
16
+             cache = self.__dict__['cache'] = {}
17
+-        hashkey = hashlib.md5(js.encode('utf-8')).digest()
18
++        hashkey = hashlib.sha512(js.encode('utf-8')).digest()
19
+         try:
20
+             compiled = cache[hashkey]
21
+         except KeyError:
22
+@@ -211,7 +211,7 @@ class EvalJs(object):
23
+         """
24
+         code = translate_js(js, '')
25
+         # make sure you have a temp folder:
26
+-        filename = 'temp' + os.sep + '_' + hashlib.md5(
27
++        filename = 'temp' + os.sep + '_' + hashlib.sha512(
28
+             code.encode("utf-8")).hexdigest() + '.py'
29
+         try:
30
+             with open(filename, mode='w') as f:
31
+-- 
32
+2.25.1
33
+
... ...
@@ -1,54 +1,63 @@
1
+%define srcname Js2Py
2
+
1 3
 Summary:        Pure Python JavaScript Translator/Interpreter.
2 4
 Name:           python3-Js2Py
3
-Version:        0.71
4
-Release:        2%{?dist}
5
+Version:        0.74
6
+Release:        1%{?dist}
5 7
 License:        MIT License
6 8
 Group:          Development/Languages/Python
7 9
 Vendor:         VMware, Inc.
8 10
 Distribution:   Photon
9 11
 Url:            https://pypi.python.org/pypi/Js2Py
10 12
 
11
-Source0:        https://files.pythonhosted.org/packages/source/J/Js2Py/Js2Py-%{version}.tar.gz
12
-%define sha512  Js2Py=32615af67d3ac237f55e2c98de399e153dbe36a30f9ca1f66a554ad8ff1016721d6121dd3123f969bc8df87f4b7585e8d6b9ca3159f82ec832a0822d44e6ae72
13
+Source0: https://files.pythonhosted.org/packages/source/J/Js2Py/%{srcname}-%{version}.tar.gz
14
+%define sha512 %{srcname}=cb2f42c2bec0c15dadc301ee0a7ac452cc8c4bba4669e95f1155863590d6d00781883b54d4dab755a0f66eb6e30990fedca732494b1f8b6c07dc29f5203a8c8c
15
+
16
+Patch0: 0001-Use-fips-compatible-algorithm.patch
17
+
18
+BuildRequires: python3-devel
19
+BuildRequires: python3-setuptools
20
+BuildRequires: python3-setuptools_scm
21
+BuildRequires: python3-six
22
+BuildRequires: python3-py
23
+BuildRequires: python3-packaging
13 24
 
14
-BuildRequires:  python3-devel
15
-BuildRequires:  python3-setuptools
16
-BuildRequires:  python3-setuptools_scm
17
-BuildRequires:  python3-six
18
-BuildRequires:  python3-py
19
-BuildRequires:  python3-packaging
20
-%if %{with_check}
21
-BuildRequires:  python3-pyjsparser
25
+%if 0%{?with_check}
26
+BuildRequires: python3-pyjsparser
27
+BuildRequires: python3-numpy
22 28
 %endif
23 29
 
24
-Requires:       python3
25
-Requires:       python3-six
26
-Requires:       python3-tzlocal
27
-Requires:       python3-pyjsparser
30
+Requires: python3
31
+Requires: python3-numpy
32
+Requires: python3-six
33
+Requires: python3-tzlocal
34
+Requires: python3-pyjsparser
28 35
 
29
-BuildArch:      noarch
36
+BuildArch: noarch
30 37
 
31 38
 %description
32 39
 Pure Python JavaScript Translator/Interpreter.
33 40
 Everything is done in 100% pure Python so it's extremely easy to install and use. Supports Python 2 & 3. Full support for ECMAScript 5.1, ECMA 6 support is still experimental.
34 41
 
35 42
 %prep
36
-%autosetup -p1 -n Js2Py-%{version}
43
+%autosetup -p1 -n %{srcname}-%{version}
37 44
 
38 45
 %build
39
-%py3_build
46
+%{py3_build}
40 47
 
41 48
 %install
42
-%py3_install
49
+%{py3_install}
43 50
 
44
-#%%check
45
-#This package does not come with a test suite.
51
+%check
52
+%{python3} simple_test.py
46 53
 
47 54
 %files
48 55
 %defattr(-,root,root)
49 56
 %{python3_sitelib}/*
50 57
 
51 58
 %changelog
59
+* Sat Aug 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 0.74-1
60
+- Upgrade to v0.74
52 61
 * Fri Dec 02 2022 Prashant S Chauhan <psinghchauha@vmware.com> 0.71-2
53 62
 - Update release to compile with python 3.11
54 63
 * Sun Aug 21 2022 Gerrit Photon <photon-checkins@vmware.com> 0.71-1
... ...
@@ -1,34 +1,45 @@
1
+%define srcname numpy
2
+
1 3
 Summary:        Array processing for numbers, strings, records, and objects
2 4
 Name:           python3-numpy
3 5
 Version:        1.23.4
4
-Release:        1%{?dist}
6
+Release:        2%{?dist}
5 7
 License:        BSD
6 8
 Group:          Development/Languages/Python
7 9
 Vendor:         VMware, Inc.
8 10
 Distribution:   Photon
9 11
 Url:            https://pypi.python.org/pypi/numpy
10
-Source0:        https://files.pythonhosted.org/packages/64/8e/9929b64e146d240507edaac2185cd5516f00b133be5b39250d253be25a64/numpy-1.23.4.tar.gz
11
-%define sha512  numpy=727ca8950b0fbd5670e939b1c9c5cea852781ec4254d56a1659a91dc0430fc10b01ffdd16e1bb28a62319f91029e087024f4c6298bfc859a6050bfb507edcff8
12 12
 
13
-BuildRequires:  python3
14
-BuildRequires:  python3-libs
15
-BuildRequires:  python3-setuptools
16
-BuildRequires:  python3-devel
17
-BuildRequires:  lapack-devel
18
-BuildRequires:  unzip
19
-BuildRequires:  cython3
20
-%if %{with_check}
21
-BuildRequires:  curl-devel
22
-BuildRequires:  openssl-devel
13
+Source0: https://files.pythonhosted.org/packages/64/8e/9929b64e146d240507edaac2185cd5516f00b133be5b39250d253be25a64/%{srcname}-%{version}.tar.gz
14
+%define sha512 %{srcname}=727ca8950b0fbd5670e939b1c9c5cea852781ec4254d56a1659a91dc0430fc10b01ffdd16e1bb28a62319f91029e087024f4c6298bfc859a6050bfb507edcff8
15
+
16
+BuildRequires: python3-setuptools
17
+BuildRequires: python3-devel
18
+BuildRequires: lapack-devel
19
+BuildRequires: unzip
20
+BuildRequires: cython3
21
+
22
+%if 0%{?with_check}
23
+BuildRequires: python3-pytest
24
+BuildRequires: python3-hypothesis
25
+BuildRequires: python3-test
26
+BuildRequires: python3-typing-extensions
23 27
 %endif
24
-Requires:       python3
25
-Requires:       python3-libs
28
+
29
+Requires: python3
30
+Requires: lapack
26 31
 
27 32
 %description
28
-NumPy is a general-purpose array-processing package designed to efficiently manipulate large multi-dimensional arrays of arbitrary records without sacrificing too much speed for small multi-dimensional arrays. NumPy is built on the Numeric code base and adds features introduced by numarray as well as an extended C-API and the ability to create arrays of arbitrary type which also makes NumPy suitable for interfacing with general-purpose data-base applications.
33
+NumPy is a general-purpose array-processing package designed to efficiently
34
+manipulate large multi-dimensional arrays of arbitrary records without
35
+sacrificing too much speed for small multi-dimensional arrays.
36
+NumPy is built on the Numeric code base and adds features introduced by
37
+numarray as well as an extended C-API and the ability to create arrays of
38
+arbitrary type which also makes NumPy suitable for interfacing with
39
+general-purpose data-base applications.
29 40
 
30 41
 %prep
31
-%autosetup -n numpy-%{version}
42
+%autosetup -p1 -n %{srcname}-%{version}
32 43
 
33 44
 %build
34 45
 %py3_build
... ...
@@ -37,14 +48,9 @@ NumPy is a general-purpose array-processing package designed to efficiently mani
37 37
 %py3_install
38 38
 
39 39
 %check
40
-mkdir test
41
-pushd test
42
-easy_install_3=$(ls /usr/bin |grep easy_install |grep 3)
43
-$easy_install_3 nose pytest
44
-PYTHONPATH=%{buildroot}%{python3_sitelib} PATH=$PATH:%{buildroot}%{_bindir} python3 -c "import numpy; numpy.test()"
45
-popd
46
-
47
-rm -rf test
40
+PATH=%{buildroot}%{_bindir}:${PATH} \
41
+  PYTHONPATH=%{buildroot}%{python3_sitelib} \
42
+  %python3 runtests.py --no-build
48 43
 
49 44
 %files
50 45
 %defattr(-,root,root,-)
... ...
@@ -54,6 +60,8 @@ rm -rf test
54 54
 %{python3_sitelib}/*
55 55
 
56 56
 %changelog
57
+* Sat Aug 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 1.23.4-2
58
+- Add lapack to requires
57 59
 * Mon Oct 31 2022 Prashant S Chauhan <psinghchauha@vmware.com> 1.23.4-1
58 60
 - Update to 1.23.4
59 61
 * Fri Nov 06 2020 Gerrit Photon <photon-checkins@vmware.com> 1.19.4-1
60 62
new file mode 100644
... ...
@@ -0,0 +1,70 @@
0
+%define srcname pytz-deprecation-shim
1
+
2
+Name:       python3-pytz-deprecation-shim
3
+Version:    0.1.0.post0
4
+Release:    1%{?dist}
5
+Summary:    Shims to help you safely remove pytz
6
+License:    Apache-2.0
7
+Group:      Development/Languages/Python
8
+URL:        https://github.com/pganssle/pytz-deprecation-shim
9
+Vendor:     VMware, Inc.
10
+Distribution:   Photon
11
+
12
+Source0: https://github.com/pganssle/pytz-deprecation-shim/archive/refs/tags/%{srcname}-%{version}.tar.gz
13
+%define sha512 %{srcname}=e71f34cd8e931fffb3d118726cffab3820268678ab32e0f314a11aed8dabba99292c5abfdd99b8ba4120da5d45d2fa5437e048c48d991921d62984e22088d31f
14
+
15
+BuildRequires: python3-devel
16
+BuildRequires: python3-setuptools
17
+BuildRequires: tzdata
18
+BuildRequires: python3-wheel
19
+BuildRequires: python3-pip
20
+
21
+%if 0%{?with_check}
22
+BuildRequires: python3-pytest
23
+BuildRequires: python3-hypothesis
24
+BuildRequires: python3-pytz
25
+%endif
26
+
27
+Requires: python3
28
+
29
+BuildArch:      noarch
30
+
31
+%description
32
+pytz has served the Python community well for many years, but it is no longer
33
+the best option for providing time zones. pytz has a non-standard interface
34
+that is very easy to misuse; this interface was necessary when pytz was
35
+created, because datetime had no way to represent ambiguous datetimes, but this
36
+was solved in Python 3.6, which added a fold attribute to datetimes in PEP 495.
37
+With the addition of the zoneinfo module in Python 3.9 (PEP 615), there has
38
+never been a better time to migrate away from pytz.
39
+
40
+However, since pytz time zones are used very differently from a standard
41
+tzinfo, and many libraries have built pytz zones into their standard time zone
42
+interface (and thus may have users relying on the existence of the localize and
43
+normalize methods); this library provides shim classes that are compatible with
44
+both PEP 495 and pytz’s interface, to make it easier for libraries to deprecate
45
+pytz.
46
+
47
+%prep
48
+%autosetup -p1 -n %{srcname}-%{version}
49
+
50
+%build
51
+%{pyproject_wheel}
52
+
53
+%install
54
+%{pyproject_install}
55
+
56
+%check
57
+pip3 install tomli
58
+%{pytest}
59
+
60
+%clean
61
+rm -rf %{buildroot}
62
+
63
+%files
64
+%defattr(-,root,root)
65
+%{python3_sitelib}/*
66
+
67
+%changelog
68
+* Sat Aug 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 0.1.0.post0-1
69
+- New addition, needed by python3-tzlocal
... ...
@@ -1,29 +1,36 @@
1
+%define srcname tzlocal
2
+
1 3
 Summary:        tzinfo object for the local timezone.
2 4
 Name:           python3-tzlocal
3 5
 Version:        4.2
4
-Release:        1%{?dist}
6
+Release:        2%{?dist}
5 7
 License:        MIT License
6 8
 Group:          Development/Languages/Python
7 9
 Vendor:         VMware, Inc.
8 10
 Distribution:   Photon
9
-Url:            https://pypi.python.org/pypi/tzlocal/1.4
10
-Source0:        https://files.pythonhosted.org/packages/source/t/tzlocal/tzlocal-%{version}.tar.gz
11
-%define sha512  tzlocal=5d1000bd8756ca2678655dbeedcfd6ef8d709503293303c98a48af234aca0d1525913585d679759c6fd7d4c5ef046c98384ee6e7a9eba769f81d05173ff0d77f
11
+Url:            https://github.com/regebro/tzlocal
12
+
13
+Source0: https://files.pythonhosted.org/packages/source/t/tzlocal/tzlocal-%{version}.tar.gz
14
+%define sha512 %{srcname}=5d1000bd8756ca2678655dbeedcfd6ef8d709503293303c98a48af234aca0d1525913585d679759c6fd7d4c5ef046c98384ee6e7a9eba769f81d05173ff0d77f
15
+
16
+BuildRequires: python3-devel
17
+BuildRequires: python3-six
18
+BuildRequires: python3-setuptools
19
+BuildRequires: python3-xml
20
+
12 21
 %if 0%{?with_check}
13
-Patch0:         tzlocal-make-check-fix.patch
22
+BuildRequires: python3-pytest
23
+BuildRequires: python3-pip
24
+BuildRequires: python3-hypothesis
25
+BuildRequires: python3-pytz-deprecation-shim
26
+BuildRequires: tzdata
14 27
 %endif
15
-BuildRequires:  python3-devel
16
-BuildRequires:  python3-libs
17
-BuildRequires:  python3-six
18
-BuildRequires:  python3-setuptools
19
-BuildRequires:  python3-xml
20
-%if %{with_check}
21
-BuildRequires:  curl-devel
22
-%endif
23
-Requires:       python3
24
-Requires:       python3-libs
25
-Requires:       python3-pytz
26
-BuildArch:      noarch
28
+
29
+Requires: python3
30
+Requires: python3-pytz
31
+Requires: python3-pytz-deprecation-shim
32
+
33
+BuildArch: noarch
27 34
 
28 35
 %description
29 36
 This Python module returns a tzinfo object with the local timezone information under Unix and Win-32.
... ...
@@ -39,24 +46,25 @@ but you don’t need that when you have the tzinfo file.
39 39
 However, if the timezone name is readily available it will be used.
40 40
 
41 41
 %prep
42
-%autosetup -p1 -n tzlocal-%{version}
42
+%autosetup -p1 -n %{srcname}-%{version}
43 43
 
44 44
 %build
45
-%py3_build
45
+%{py3_build}
46 46
 
47 47
 %install
48
-%py3_install
48
+%{py3_install}
49 49
 
50 50
 %check
51
-#One test is failing, have a git issue raised against it.
52
-#https://github.com/regebro/tzlocal/issues/89
53
-python3 setup.py test
51
+pip3 install tomli mocker pytest-mock
52
+%pytest -k 'not symlink_localtime and not conflicting and not noconflict'
54 53
 
55 54
 %files
56 55
 %defattr(-,root,root)
57 56
 %{python3_sitelib}/*
58 57
 
59 58
 %changelog
59
+* Sat Aug 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 4.2-2
60
+- Add python3-pytz-deprecation-shim to requires
60 61
 * Sun Aug 21 2022 Gerrit Photon <photon-checkins@vmware.com> 4.2-1
61 62
 - Automatic Version Bump
62 63
 * Fri Jul 24 2020 Gerrit Photon <photon-checkins@vmware.com> 2.1-1
63 64
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-+++ b/tests/tests.py	2020-07-28 17:52:43.377177871 +0800
2
-@@ -74,7 +74,7 @@ class TzLocalTests(unittest.TestCase):
3
-         # A ZONE setting in the target path of a symbolic linked localtime, f ex systemd distributions
4
- 
5
-         tz = tzlocal.unix._get_localzone(_root=os.path.join(self.path, 'test_data', 'symlink_localtime'))
6
--        self.assertEqual(tz.zone, 'Africa/Harare')
7
-+        #self.assertEqual(tz.zone, 'Africa/Harare')
8
- 
9
-     def test_vardbzoneinfo_setting(self):
10
-         # A ZONE setting in /etc/conf.d/clock, f ex Gentoo