rpms/python-smbpasswd/devel python-smbpasswd-1.0.1-py3.patch, NONE, 1.1 python-smbpasswd.spec, 1.11, 1.12

Jochen Schmitt s4504kr at fedoraproject.org
Tue Feb 2 17:13:39 UTC 2010


Author: s4504kr

Update of /cvs/pkgs/rpms/python-smbpasswd/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9767

Modified Files:
	python-smbpasswd.spec 
Added Files:
	python-smbpasswd-1.0.1-py3.patch 
Log Message:
Porting for python-3.1

python-smbpasswd-1.0.1-py3.patch:
 README.txt  |    6 +++---
 setup.py    |    2 +-
 smbpasswd.c |   15 +++++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

--- NEW FILE python-smbpasswd-1.0.1-py3.patch ---
diff -up python3-python-smbpasswd-1.0.1-12.fc13/README.txt.org python3-python-smbpasswd-1.0.1-12.fc13/README.txt
--- python3-python-smbpasswd-1.0.1-12.fc13/README.txt.org	2004-12-16 04:55:18.000000000 +0100
+++ python3-python-smbpasswd-1.0.1-12.fc13/README.txt	2010-02-02 17:35:59.398053959 +0100
@@ -26,10 +26,10 @@ In Python:
 
     passwd = 'mypassword'
 
-    print 'LANMAN hash is', smbpasswd.lmhash(passwd)
-    print 'NT hash is', smbpasswd.nthash(passwd)
+    print ('LANMAN hash is', smbpasswd.lmhash(passwd))
+    print ('NT hash is', smbpasswd.nthash(passwd))
 
-    print 'both hashes at once = %s:%s' % smbpasswd.hash(passwd)
+    print ('both hashes at once = %s:%s' % smbpasswd.hash(passwd))
 
 ------------------------------------------------------------
                                             Enjoy
diff -up python3-python-smbpasswd-1.0.1-12.fc13/setup.py.org python3-python-smbpasswd-1.0.1-12.fc13/setup.py
--- python3-python-smbpasswd-1.0.1-12.fc13/setup.py.org	2004-12-16 04:54:08.000000000 +0100
+++ python3-python-smbpasswd-1.0.1-12.fc13/setup.py	2010-02-02 17:35:59.398053959 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Python Distutils Setup file for py-smbpasswd module.  Build and
 # install with:
diff -up python3-python-smbpasswd-1.0.1-12.fc13/smbpasswd.c.org python3-python-smbpasswd-1.0.1-12.fc13/smbpasswd.c
--- python3-python-smbpasswd-1.0.1-12.fc13/smbpasswd.c.org	2004-12-16 04:54:08.000000000 +0100
+++ python3-python-smbpasswd-1.0.1-12.fc13/smbpasswd.c	2010-02-02 17:40:27.153054531 +0100
@@ -70,7 +70,7 @@ hash_to_string(char *tmp) 
         outbuffer[(i*2)+1] = HEXCHARS[   c   & 0x0f];
         }
         
-    return PyString_FromStringAndSize(outbuffer, 32);
+    return PyUnicode_FromStringAndSize(outbuffer, 32);
     }
 
 
@@ -158,12 +158,19 @@ static PyMethodDef smbpasswd_functions[]
     {NULL,      NULL}   /* Sentinel */
     };
 
+static struct PyModuleDef smbpasswdmodule = 
+  { PyModuleDef_HEAD_INIT,
+    "smbpasswd",
+    module_doc,
+    -1,
+    smbpasswd_functions
+  };
 
 /* Initialize this module. */
-void 
-initsmbpasswd(void)
+PyMODINIT_FUNC 
+PyInit_smbpasswd(void)
     {
-    Py_InitModule3("smbpasswd", smbpasswd_functions, module_doc);
+      return PyModule_Create(&smbpasswdmodule);
     }
 
 /****** EOF *********/


Index: python-smbpasswd.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-smbpasswd/devel/python-smbpasswd.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- python-smbpasswd.spec	3 Aug 2009 18:38:52 -0000	1.11
+++ python-smbpasswd.spec	2 Feb 2010 17:13:39 -0000	1.12
@@ -1,46 +1,91 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
-%{!?python_abi: %define python_abi %(%{__python} -c "import sys; print sys.version[:3]")}
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+
+%if 0%{?fedora} > 12
+%global with_python3 1
+%endif
 
 Name:           python-smbpasswd
 Version:        1.0.1
-Release:        12%{?dist}
+Release:        13%{?dist}
 Summary:        Python SMB Password Hash Generator Module
 
 Group:          Development/Languages
 License:        GPLv2
 URL:            http://barryp.org/software/py-smbpasswd
 Source0:        http://barryp.org/software/py-smbpasswd/files/py-smbpasswd-%{version}.tar.gz
+Patch1:		python-smbpasswd-1.0.1-py3.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-BuildRequires:  python-devel
+BuildRequires:  python3-devel
+BuildRequires:	python2-devel
 
 %description
 This package contains a python module, which is able to generate LANMAN and
 NT password hashes suiteable to us with Samba.
 
+%if 0%{?with_python3}
+%package -n python3-smbpasswd
+Summary:	Python SMB Password Hst Generator Module for Python 3
+Group:		Development/Languages
+
+%description -n python3-smbpasswd
+This package contains a python module, which is able to generate LANMAN and
+NT password hashes suiteable to us with Samba.
+
+This is a ported release for python 3.1
+%endif
+
 %prep
 %setup -q -n py-smbpasswd-%{version}
-chmod 0644 smbpasswd.c
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+cd %{py3dir}
+%patch1 -p1 -b .org
+%endif
 
 %build
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+CFLAGS="$RPM_OPT_FLAGS" 
+%{__python} setup.py build
+
+%if 0%{?with_python3}
+cd %{py3dir}
+%{__python3} setup.py build
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
- 
+
+%if 0%{?with_python3}
+cd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%endif 
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root,-)
 %{python_sitearch}/smbpasswd.so
-%{python_sitearch}/*.egg-info
+%{python_sitearch}/*egg-info
+
+%doc COPYING README.txt
+
+%if 0%{?with_python3}
+%files -n python3-smbpasswd
+%defattr(-,root,root,-)
+%{python3_sitearch}/smbpasswd.so
+%{python3_sitearch}/*egg-info
+%endif
 
 %doc COPYING README.txt
 
 %changelog
+* Tue Feb  2 2010 Jochen Schmitt <Jochen herr-schmitt de> 1.0.1-13
+- Port for python-3
+
 * Mon Aug  3 2009 Jochen Schmitt <Jochen herr-schmitt de> 1.0.1-12
 - Rebuild for python-2.6.2
 



More information about the scm-commits mailing list