Skip to content

Commit

Permalink
Bump release to 0.3.0
Browse files Browse the repository at this point in the history
Change packaging so that it only produces a single package for the
default python interpreter on the system.
  • Loading branch information
sgallagher committed Mar 24, 2015
1 parent 3b4b4a5 commit e215730
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 75 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="sscg",
version="0.2.1",
version="0.3.0",
use_2to3=True,

entry_points="""\
Expand Down
111 changes: 37 additions & 74 deletions python-sscg.spec → sscg.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
%if (0%{?fedora} >= 13 || 0%{?rhel} >= 7)
%global with_python3 1
%if (0%{?fedora} >= 22 || 0%{?rhel} >= 8)
%global use_python3 1
%endif
%endif

%global srcname sscg

Name: python-%{srcname}
Version: 0.2.1
Name: %{srcname}
Version: 0.3.0
Release: 1%{?dist}
Summary: Self-signed certificate generator

Expand All @@ -17,111 +14,77 @@ URL: https://github.com/sgallagher/%{srcname}
Source0: https://github.com/sgallagher/%{srcname}/releases/download/%{srcname}-%{version}/%{srcname}-%{version}.tar.gz

BuildArch: noarch
Requires: pyOpenSSL
Requires: python-pyasn1
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: pyOpenSSL
BuildRequires: python-pyasn1

%description
A utility to aid in the creation of more secure "self-signed"
certificates. The certificates created by this tool are generated in a
way so as to create a CA certificate that can be safely imported into a
client machine to trust the service certificate without needing to set
up a full PKI environment and without exposing the machine to a risk of
false signatures from the service certificate.

%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Self-signed certificate generator
%if 0%{?use_python3}
Requires: python3-pyOpenSSL
Requires: python3-pyasn1
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pyOpenSSL
BuildRequires: python3-pyasn1
%else
Requires: pyOpenSSL
Requires: python-pyasn1
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: pyOpenSSL
BuildRequires: python-pyasn1
%endif

%description -n python3-%{srcname}
%description
A utility to aid in the creation of more secure "self-signed"
certificates. The certificates created by this tool are generated in a
way so as to create a CA certificate that can be safely imported into a
client machine to trust the service certificate without needing to set
up a full PKI environment and without exposing the machine to a risk of
false signatures from the service certificate.
%endif #0%{?with_python3}

%prep
%setup -qc -n %{srcname}-%{version}

mv %{srcname}-%{version} python2
find python2 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%setup -q -n %{srcname}-%{version}

%if 0%{?with_python3}
rm -rf python3
cp -a python2 python3
find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif #0%{?with_python3}
# Set any script hashbangs to the appropriate python version
%if 0%{?use_python3}
find . -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%else
find . -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%endif #0%{?use_python3}

%build
# Ensure egg-info is regenerated
rm -rf src/*.egg-info

pushd python2
%{__python2} setup.py build
popd

%if 0%{?with_python3}
pushd python3
%if 0%{?use_python3}
%{__python3} setup.py build
popd
%endif # with_python3
%else
%{__python2} setup.py build
%endif # use_python3

%install
rm -rf $RPM_BUILD_ROOT

pushd python2
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
mv $RPM_BUILD_ROOT/%{_bindir}/%{srcname} \
$RPM_BUILD_ROOT/%{_bindir}/%{srcname}-%{python2_version}
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
mv $RPM_BUILD_ROOT/%{_bindir}/%{srcname} \
$RPM_BUILD_ROOT/%{_bindir}/%{srcname}-%{python3_version}
popd
%endif # with_python3

# On platforms where python3 is preferred, symlink that version
# to /usr/bin/%{srcname}
%if 0%{?use_python3}
ln -s %{srcname}-%{python3_version} $RPM_BUILD_ROOT/%{_bindir}/%{srcname}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
%else
ln -s %{srcname}-%{python2_version} $RPM_BUILD_ROOT/%{_bindir}/%{srcname}
%endif #use_python3
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%endif # use_python3

%files
%license python2/src/sscg/LICENSE
# For noarch packages: sitelib
%{python2_sitelib}/*
%{_bindir}/%{srcname}-%{python2_version}
%if !0%{?use_python3}
%license src/sscg/LICENSE
%{_bindir}/%{srcname}
%endif

%if 0%{?with_python3}
%files -n python3-%{srcname}
%license python3/src/sscg/LICENSE
%{python3_sitelib}/*
%{_bindir}/%{srcname}-%{python3_version}
%if 0%{?use_python3}
%{_bindir}/%{srcname}
%{python3_sitelib}/%{srcname}/*
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/
%else
%{python2_sitelib}/%{srcname}/*
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info/
%endif #use_python3
%endif #with_python3

%changelog
* Mon Mar 23 2015 Stephen Gallagher <[email protected]> 0.3.0-1
- Rename to sscg
- Only build with default python interpreter

* Tue Mar 17 2015 Stephen Gallagher <[email protected]> 0.2.1-1
- Include the LICENSE file in the tarball

Expand Down

0 comments on commit e215730

Please sign in to comment.