6e1e1b3
%global pythonver %(%{__python} -c "import sys; print sys.version[:3]" 2>/dev/null || echo 0.0)
6e1e1b3
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" 2>/dev/null)}
cvsextras aa0934e
52aa704
Summary:	Cryptography library for Python
52aa704
Name:		python-crypto
b05e574
Version:	2.3
dd5125f
Release:	5%{?dist}
8e2c78d
# Mostly Public Domain apart from parts of HMAC.py and setup.py, which are Python
8e2c78d
License:	Public Domain and Python
52aa704
Group:		Development/Libraries
8e2c78d
URL:		http://www.pycrypto.org/
8e2c78d
Source0:	http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-%{version}.tar.gz
6e1e1b3
Patch0:		python-crypto-2.2-optflags.patch
b05e574
Patch1:		pycrypto-2.3-lib64.patch
0e2cbb5
Provides:	pycrypto = %{version}-%{release}
b05e574
BuildRequires:	python2-devel >= 2.2, gmp-devel >= 4.1
dd5125f
BuildRoot:	%{_tmppath}/%{name}-%{version}-buildroot-%(id -nu)
cvsextras aa0934e
8e2c78d
# Don't want provides for python shared objects
8e2c78d
%{?filter_provides_in: %filter_provides_in %{python_sitearch}/Crypto/.*\.so}
8e2c78d
%{?filter_setup}
8e2c78d
cvsextras aa0934e
%description
cvsextras aa0934e
Python-crypto is a collection of both secure hash functions (such as MD5 and
dd5125f
SHA), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.).
7b95cf4
cvsextras aa0934e
%prep
dd5125f
%setup -n pycrypto-%{version} -q
7b95cf4
8e2c78d
# Use distribution compiler flags rather than upstream's
8e2c78d
%patch0 -p1
8e2c78d
b05e574
# Look in the right place for libgmp
b05e574
%if "%{_lib}" == "lib64"
b05e574
%patch1 -p1
b05e574
%endif
b05e574
8e2c78d
# Remove spurious shellbangs
dd5125f
sed -i -e '\|^#!/usr/local/bin/python| d' lib/Crypto/Util/RFC1751.py
8e2c78d
8e2c78d
# Fix permissions for debuginfo
dd5125f
chmod -c -x src/_fastmath.c
cvsextras aa0934e
8e2c78d
%build
7df176f
CFLAGS="%{optflags} -fno-strict-aliasing" %{__python} setup.py build
7b95cf4
cvsextras aa0934e
%install
dd5125f
rm -rf %{buildroot}
8e2c78d
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
cvsextras aa0934e
8e2c78d
# Remove group write permissions on shared objects
dd5125f
find %{buildroot}%{python_sitearch} -name '*.so' -exec chmod -c g-w {} \;
7b95cf4
8e2c78d
# See if there's any egg-info
8e2c78d
if [ -f %{buildroot}%{python_sitearch}/pycrypto-%{version}-py%{pythonver}.egg-info ]; then
8e2c78d
	echo %{python_sitearch}/pycrypto-%{version}-py%{pythonver}.egg-info
8e2c78d
fi > egg-info
cvsextras aa0934e
8e2c78d
%check
8e2c78d
%{__python} setup.py test
7b95cf4
b05e574
# Benchmark uses os.urandom(), which is available from python 2.4
b05e574
%if %(%{__python} -c "import sys; print sys.hexversion >= 0x02040000 and 1 or 0" 2>/dev/null || echo 0)
b05e574
PYTHONPATH=%{buildroot}%{python_sitearch} %{__python} pct-speedtest.py
b05e574
%endif
b05e574
8e2c78d
%clean
dd5125f
rm -rf %{buildroot}
cvsextras aa0934e
8e2c78d
%files -f egg-info
8e2c78d
%defattr(-,root,root,-)
8e2c78d
%doc README TODO ACKS ChangeLog LEGAL/ COPYRIGHT Doc/
8e2c78d
%{python_sitearch}/Crypto/
7b95cf4
cvsextras aa0934e
%changelog
dd5125f
* Wed May 11 2011 Paul Howarth <paul@city-fan.org> - 2.3-5
dd5125f
- Upstream rolled new tarball with top-level directory restored
dd5125f
- Nobody else likes macros for commands
dd5125f
4316659
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3-4
4316659
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
4316659
Jesse Keating 7d08ba5
* Wed Sep 29 2010 jkeating - 2.3-3
Jesse Keating 7d08ba5
- Rebuilt for gcc bug 634757
Jesse Keating 7d08ba5
7df176f
* Fri Sep 24 2010 David Malcolm <dmalcolm@redhat.com> - 2.3-2
7df176f
- add "-fno-strict-aliasing" to compilation flags
7df176f
b05e574
* Fri Aug 27 2010 Paul Howarth <paul@city-fan.org> - 2.3-1
b05e574
- Update to 2.3
b05e574
  - Fix NameError when attempting to use deprecated getRandomNumber() function
b05e574
  - _slowmath: Compute RSA u parameter when it's not given to RSA.construct;
b05e574
    this makes _slowmath behave the same as _fastmath in this regard
b05e574
  - Make RSA.generate raise a more user-friendly exception message when the
b05e574
    user tries to generate a bogus-length key
b05e574
- Add -c option to %%setup because upstream tarball has dropped the top-level
b05e574
  directory
b05e574
- Run benchmark as part of %%check if we have python 2.4 or later
b05e574
- BR: python2-devel rather than just python-devel
b05e574
- Add patch to make sure we can find libgmp in 64-bit multilib environments
b05e574
6e1e1b3
* Tue Aug  3 2010 Paul Howarth <paul@city-fan.org> - 2.2-1
6e1e1b3
- Update to 2.2
6e1e1b3
  - Deprecated Crypto.Util.number.getRandomNumber()
6e1e1b3
  - It's been replaced by getRandomNBitInteger and getRandomInteger
6e1e1b3
  - Better isPrime() and getPrime() implementations
6e1e1b3
  - getStrongPrime() implementation for generating RSA primes
6e1e1b3
  - Support for importing and exporting RSA keys in DER and PEM format
6e1e1b3
  - Fix PyCrypto when floor division (python -Qnew) is enabled
6e1e1b3
  - When building using gcc, use -std=c99 for compilation
6e1e1b3
- Update optflags patch
6e1e1b3
e1b37c3
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.1.0-2
e1b37c3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
e1b37c3
8e2c78d
* Tue Feb 16 2010 Paul Howarth <paul@city-fan.org> - 2.1.0-1
8e2c78d
- Update to 2.1.0 (see ChangeLog for details)
8e2c78d
- Remove patches (no longer needed)
8e2c78d
- Use new upstream URLs
8e2c78d
- Upstream has replaced LICENSE with LEGAL/ and COPYRIGHT
8e2c78d
- Clarify that license is mostly Public Domain, partly Python
8e2c78d
- Add %%check section and run the test suite in it
8e2c78d
- Remove upstream's fiddling with compiler optimization flags so we get
8e2c78d
  usable debuginfo
8e2c78d
- Filter out unwanted provides for python shared objects
8e2c78d
- Tidy up egg-info handling
8e2c78d
- Simplify %%files list
8e2c78d
- Pacify rpmlint as much as is reasonable
8e2c78d
- Add dist tag
8e2c78d
c042095
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-19
c042095
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
c042095
4d97d94
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-18
4d97d94
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
4d97d94
966c970
* Fri Feb 13 2009 Stewart Adam <s.adam at diffingo.com> - 2.0.1-17
3491ecd
- Use patches in upstream git to fix #484473
3491ecd
966c970
* Fri Feb 13 2009 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 2.0.1-16.1
34bd83b
- add patch to fix #485298 / CVE-2009-0544
34bd83b
0fcc524
* Sat Feb 7 2009 Stewart Adam <s.adam at diffingo.com> - 2.0.1-15.1
0fcc524
- Oops, actually apply the patch
0fcc524
- Modify patch so modules remain compatible with PEP 247
0fcc524
f7ff1fe
* Sat Feb 7 2009 Stewart Adam <s.adam at diffingo.com> - 2.0.1-15
f7ff1fe
- Add patch to hashlib instead of deprecated md5 and sha modules (#484473)
f7ff1fe
d02da07
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.1-14.1
d02da07
- Rebuild for Python 2.6
d02da07
0e2cbb5
* Sun May 04 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 2.0.1-13
0e2cbb5
- provide pycrypto
0e2cbb5
20b818a
* Sat Feb 09 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 2.0.1-12
20b818a
- rebuilt
20b818a
a391e18
* Fri Jan 04 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.0.1-11
a391e18
- egg-info file in python_sitearch and not in python_sitelib
a391e18
f86636c
* Fri Jan 04 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.0.1-10
f86636c
- ship egg-file
f86636c
b47b532
* Tue Aug 21 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.0.1-9
b47b532
- Remove the old and outdated python-abi hack
b47b532
75e47dc
* Fri Aug 03 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>
75e47dc
- Update License field due to the "Licensing guidelines changes"
75e47dc
ea90e2c
* Mon Jun 04 2007 David Woodhouse <dwmw2@infradead.org> - 2.0.1-8
ea90e2c
- Fix libdir handling so it works on more arches than x86_64
ea90e2c
970b758
* Wed Apr 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-7
970b758
- Fix typo
970b758
970b758
* Wed Apr 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-6
67c24c3
- Remove dist
67c24c3
- rebuild, because the older version was much bigger, as it was build when
67c24c3
  distutils was doing static links of libpython
67c24c3
cf6d2b4
* Sat Dec 09 2006 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-5
cf6d2b4
- Rebuild for python 2.5
cf6d2b4
b26796d
* Thu Sep 07 2006 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-4
b26796d
- Don't ghost pyo files (#205408)
b26796d
883c6bb
* Tue Aug 29 2006 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-3
883c6bb
- Rebuild for Fedora Extras 6
883c6bb
883c6bb
* Mon Feb 13 2006 Thorsten Leemhuis <fedora[AT]leemhuis.info> - 2.0.1-2
e2d1539
- Rebuild for Fedora Extras 5
e2d1539
7b95cf4
* Wed Aug 17 2005 Thorsten Leemhuis <fedora at leemhuis dot info> - 0:2.0.1-1
7b95cf4
- Update to 2.0.1
7b95cf4
- Use Dist
7b95cf4
- Drop python-crypto-64bit-unclean.patch, similar patch was applied 
7b95cf4
  upstream
7b95cf4
7c598f6
* Thu May 05 2005 Thorsten Leemhuis <fedora at leemhuis dot info> - 0:2.0-4
7c598f6
- add python-crypto-64bit-unclean.patch (#156173)
7c598f6
Seth Vidal fbdcb7b
* Mon Mar 21 2005 Seth Vidal <skvidal at phy.duke.edu> - 0:2.0-3
Seth Vidal fbdcb7b
- iterate release for build on python 2.4 based systems
Seth Vidal fbdcb7b
7563796
* Sat Dec 18 2004 Thorsten Leemhuis <fedora at leemhuis dot info> - 0:2.0-2
7563796
- Fix build on x86_64: use python_sitearch for files and patch source
52aa704
  to find gmp
7563796
cvsextras 04247e3
* Thu Aug 26 2004 Thorsten Leemhuis <fedora at leemhuis dot info> - 0:2.0-0.fdr.1
cvsextras 04247e3
- Update to 2.00
cvsextras 04247e3
cvsextras 04247e3
* Fri Aug 13 2004 Ville Skytta <ville.skytta at iki.fi> - 0:1.9-0.fdr.6.a6
cvsextras aa0934e
- Don't use get_python_version(), it's available in Python >= 2.3 only.
cvsextras aa0934e
cvsextras 04247e3
* Thu Aug 12 2004 Thorsten Leemhuis <fedora at leemhuis dot info> 0:1.9-0.fdr.5.a6
cvsextras aa0934e
- Own dir python_sitearch/Crypto/
cvsextras aa0934e
cvsextras 04247e3
* Wed Aug 11 2004 Thorsten Leemhuis <fedora at leemhuis dot info> 0:1.9-0.fdr.4.a6
cvsextras aa0934e
- Match python spec template more
cvsextras aa0934e
cvsextras 04247e3
* Sat Jul 17 2004 Thorsten Leemhuis <fedora at leemhuis dot info> 0:1.9-0.fdr.3.a6
cvsextras aa0934e
- Own _libdir/python/site-packages/Crypto/
cvsextras aa0934e
cvsextras aa0934e
* Wed Mar 24 2004 Panu Matilainen <pmatilai@welho.com> 0.3.2-0.fdr.2.a6
cvsextras aa0934e
- generate .pyo files during install
cvsextras aa0934e
- require exact version of python used to build the package
cvsextras aa0934e
- include more docs + demos
cvsextras aa0934e
- fix dependency on /usr/local/bin/python
cvsextras aa0934e
- use fedora.us style buildroot
cvsextras aa0934e
- buildrequires gmp-devel
cvsextras aa0934e
- use description from README
cvsextras aa0934e
cvsextras aa0934e
* Sun Jan 11 2004 Ryan Boder <icanoop@bitwiser.org>  0.3.2-0.fdr.1.a6
cvsextras aa0934e
- Initial build.
cvsextras aa0934e