Browse code

Added package psycopg2 (Bug 1857965)

Change-Id: I37bec86d7445da3de64cc5c121f3135b19940703
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2536
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

xiaolin-vmware authored on 2017/04/27 06:40:46
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,78 @@
0
+%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+
3
+Summary:        Python-PostgreSQL Database Adapter
4
+Name:           python-psycopg2
5
+Version:        2.7.1
6
+Release:        1%{?dist}
7
+Url:            https://pypi.python.org/pypi/psycopg2
8
+License:        LGPL with exceptions or ZPL
9
+Group:          Development/Languages/Python
10
+Vendor:         VMware, Inc.
11
+Distribution:   Photon
12
+Source0:        https://files.pythonhosted.org/packages/source/p/psycopg2/psycopg2-%{version}.tar.gz
13
+%define sha1    psycopg2=284ae137dc4ddf1855d47f7e92434fcd06a27ec6
14
+
15
+BuildRequires:  python2
16
+BuildRequires:  python2-libs
17
+BuildRequires:  python2-devel
18
+BuildRequires:  python-setuptools
19
+BuildRequires:  postgresql
20
+Requires:       python2
21
+Requires:       python2-libs
22
+Requires:       postgresql
23
+
24
+%description
25
+Psycopg is the most popular PostgreSQL database adapter for the Python programming language. Its main features are the complete implementation of the Python DB API 2.0 specification and the thread safety (several threads can share the same connection). It was designed for heavily multi-threaded applications that create and destroy lots of cursors and make a large number of concurrent “INSERT”s or “UPDATE”s.
26
+
27
+Psycopg 2 is mostly implemented in C as a libpq wrapper, resulting in being both efficient and secure. It features client-side and server-side cursors, asynchronous communication and notifications, “COPY TO/COPY FROM” support. Many Python types are supported out-of-the-box and adapted to matching PostgreSQL data types; adaptation can be extended and customized thanks to a flexible objects adaptation system.
28
+
29
+Psycopg 2 is both Unicode and Python 3 friendly.
30
+
31
+%package -n     python3-psycopg2
32
+Summary:        python-psycopg2
33
+BuildRequires:  python3
34
+BuildRequires:  python3-devel
35
+BuildRequires:  python3-libs
36
+BuildRequires:  postgresql
37
+Requires:       python3
38
+Requires:       python3-libs
39
+Requires:       postgresql
40
+
41
+%description -n python3-psycopg2
42
+Python 3 version.
43
+
44
+%prep
45
+%setup -q -n psycopg2-%{version}
46
+rm -rf ../p3dir
47
+cp -a . ../p3dir
48
+
49
+%build
50
+python2 setup.py build
51
+pushd ../p3dir
52
+python3 setup.py build
53
+popd
54
+
55
+%install
56
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
57
+pushd ../p3dir
58
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
59
+popd
60
+
61
+%check
62
+python2 setup.py test
63
+pushd ../p3dir
64
+python3 setup.py test
65
+popd
66
+
67
+%files
68
+%defattr(-,root,root)
69
+%{python2_sitelib}/*
70
+
71
+%files -n python3-psycopg2
72
+%defattr(-,root,root,-)
73
+%{python3_sitelib}/*
74
+
75
+%changelog
76
+*   Wed Apr 26 2017 Xialin Li <xiaolinl@vmware.com> 2.7.1-1
77
+-   Initial packaging for Photon