File python3-boto.spec of Package python3-boto

#
# spec file for package python3-boto
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python3-boto
Version:        2.38.0
Release:        0
Url:            https://github.com/boto/boto/
Summary:        Amazon Web Services Library
License:        MIT
Group:          Development/Languages/Python
Source:         https://pypi.python.org/packages/source/b/boto/boto-%{version}.tar.gz
Source1:        boto.cfg
BuildRequires:  fdupes
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-paramiko
BuildRequires:  python3-xml
# Documentation requirement
BuildRequires:  python3-Sphinx
Requires:       python3-paramiko
Requires:       python3-xml
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
An integrated interface to current and future infrastructural services offered
by Amazon Web Services. At the moment, boto supports:

 * Compute
  - Amazon Elastic Compute Cloud (EC2)
  - Amazon Elastic Map Reduce (EMR)
  - AutoScaling
  - Amazon Kinesis
 * Content Delivery
  - Amazon CloudFront
 * Database
  - Amazon Relational Data Service (RDS)
  - Amazon DynamoDB
  - Amazon SimpleDB
  - Amazon ElastiCache
  - Amazon Redshift
 * Deployment and Management
  - AWS Elastic Beanstalk
  - AWS CloudFormation
  - AWS Data Pipeline
  - AWS Opsworks
  - AWS CloudTrail
 * Identity & Access
  - AWS Identity and Access Management (IAM)
 * Application Services
  - Amazon CloudSearch
  - Amazon Elastic Transcoder
  - Amazon Simple Workflow Service (SWF)
  - Amazon Simple Queue Service (SQS)
  - Amazon Simple Notification Server (SNS)
  - Amazon Simple Email Service (SES)
 * Monitoring
  - Amazon CloudWatch (EC2 Only)
  - Amazon CloudWatch Logs
 * Networking
  - Amazon Route53
  - Amazon Virtual Private Cloud (VPC)
  - Elastic Load Balancing (ELB)
  - AWS Direct Connect
 * Payments and Billing
  - Amazon Flexible Payment Service (FPS)
 * Storage
  - Amazon Simple Storage Service (S3)
  - Amazon Glacier
  - Amazon Elastic Block Store (EBS)
  - Google Cloud Storage
 * Workforce
  - Amazon Mechanical Turk
 * Other
  - Marketplace Web Services
  - AWS Support

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/Other
Requires:       %{name} = %{version}

%description doc

An integrated interface to current and future infrastructural services offered
by Amazon Web Services.

This subpackage contains the documentation for %{name}.

%prep
%setup -q -n boto-%{version}
# remove unwanted shebang
sed -i '/^#!/d' boto/{services/bs,services/result,pyami/launch_ami}.py

# break the dependency between the doc generation and boto
sed -i -e '/import boto/d' -e "s/boto\.__version__/\'%{version}\'/" docs/source/conf.py

%build
python3 setup.py build

# build HTML documentation
cd docs && make html && rm -f build/html/.buildinfo

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
%fdupes %{buildroot}%{_prefix}
mkdir %{buildroot}%{_sysconfdir}
cp %{SOURCE1} %{buildroot}%{_sysconfdir}
%fdupes docs/build/html/

# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in asadmin bundle_image cfadmin cq cwutil dynamodb_dump dynamodb_load elbadmin fetch_file glacier instance_events kill_instance launch_instance list_instances lss3 mturk pyami_sendmail route53 s3put sdbadmin taskadmin ; do
    mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py3_ver}
    ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
    # create a dummy target for /etc/alternatives/$p
    touch %{buildroot}%{_sysconfdir}/alternatives/$p
done
mv %{buildroot}%{_sysconfdir}/boto.cfg %{buildroot}%{_sysconfdir}/boto-%{py3_ver}.cfg
ln -s -f %{_sysconfdir}/alternatives/boto.cfg %{buildroot}%{_sysconfdir}/boto.cfg
# create a dummy target for /etc/alternatives/boto.cfg
touch %{buildroot}%{_sysconfdir}/alternatives/boto.cfg

%post
%_sbindir/update-alternatives \
   --install %{_bindir}/asadmin asadmin %{_bindir}/asadmin-%{py3_ver} 30 \
   --slave %{_bindir}/bundle_image bundle_image %{_bindir}/bundle_image-%{py3_ver} \
   --slave %{_bindir}/cfadmin cfadmin %{_bindir}/cfadmin-%{py3_ver} \
   --slave %{_bindir}/cq cq %{_bindir}/cq-%{py3_ver} \
   --slave %{_bindir}/cwutil cwutil %{_bindir}/cwutil-%{py3_ver} \
   --slave %{_bindir}/dynamodb_dump dynamodb_dump %{_bindir}/dynamodb_dump-%{py3_ver} \
   --slave %{_bindir}/dynamodb_load dynamodb_load %{_bindir}/dynamodb_load-%{py3_ver} \
   --slave %{_bindir}/elbadmin elbadmin %{_bindir}/elbadmin-%{py3_ver} \
   --slave %{_bindir}/fetch_file fetch_file %{_bindir}/fetch_file-%{py3_ver} \
   --slave %{_bindir}/glacier glacier %{_bindir}/glacier-%{py3_ver} \
   --slave %{_bindir}/instance_events instance_events %{_bindir}/instance_events-%{py3_ver} \
   --slave %{_bindir}/kill_instance kill_instance %{_bindir}/kill_instance-%{py3_ver} \
   --slave %{_bindir}/launch_instance launch_instance %{_bindir}/launch_instance-%{py3_ver} \
   --slave %{_bindir}/list_instances list_instances %{_bindir}/list_instances-%{py3_ver} \
   --slave %{_bindir}/lss3 lss3 %{_bindir}/lss3-%{py3_ver} \
   --slave %{_bindir}/mturk mturk %{_bindir}/mturk-%{py3_ver} \
   --slave %{_bindir}/pyami_sendmail pyami_sendmail %{_bindir}/pyami_sendmail-%{py3_ver} \
   --slave %{_bindir}/route53 route53 %{_bindir}/route53-%{py3_ver} \
   --slave %{_bindir}/s3put s3put %{_bindir}/s3put-%{py3_ver} \
   --slave %{_bindir}/sdbadmin sdbadmin %{_bindir}/sdbadmin-%{py3_ver} \
   --slave %{_bindir}/taskadmin taskadmin %{_bindir}/taskadmin-%{py3_ver} \
   --slave %{_sysconfdir}/boto.cfg boto.cfg %{_sysconfdir}/boto-%{py3_ver}.cfg

%preun
if [ $1 -eq 0 ] ; then
    %_sbindir/update-alternatives --remove asadmin %{_bindir}/asadmin-%{py3_ver}
fi

%files
%defattr(-,root,root,-)
%doc README.rst
%config %{_sysconfdir}/boto.cfg
%{_bindir}/asadmin
%{_bindir}/bundle_image
%{_bindir}/cfadmin
%{_bindir}/cq
%{_bindir}/cwutil
%{_bindir}/dynamodb_dump
%{_bindir}/dynamodb_load
%{_bindir}/elbadmin
%{_bindir}/fetch_file
%{_bindir}/glacier
%{_bindir}/instance_events
%{_bindir}/kill_instance
%{_bindir}/launch_instance
%{_bindir}/list_instances
%{_bindir}/lss3
%{_bindir}/mturk
%{_bindir}/pyami_sendmail
%{_bindir}/route53
%{_bindir}/s3put
%{_bindir}/sdbadmin
%{_bindir}/taskadmin
%config %{_sysconfdir}/boto-%{py3_ver}.cfg
%{_bindir}/asadmin-%{py3_ver}
%{_bindir}/bundle_image-%{py3_ver}
%{_bindir}/cfadmin-%{py3_ver}
%{_bindir}/cq-%{py3_ver}
%{_bindir}/cwutil-%{py3_ver}
%{_bindir}/dynamodb_dump-%{py3_ver}
%{_bindir}/dynamodb_load-%{py3_ver}
%{_bindir}/elbadmin-%{py3_ver}
%{_bindir}/fetch_file-%{py3_ver}
%{_bindir}/glacier-%{py3_ver}
%{_bindir}/instance_events-%{py3_ver}
%{_bindir}/kill_instance-%{py3_ver}
%{_bindir}/launch_instance-%{py3_ver}
%{_bindir}/list_instances-%{py3_ver}
%{_bindir}/lss3-%{py3_ver}
%{_bindir}/mturk-%{py3_ver}
%{_bindir}/pyami_sendmail-%{py3_ver}
%{_bindir}/route53-%{py3_ver}
%{_bindir}/s3put-%{py3_ver}
%{_bindir}/sdbadmin-%{py3_ver}
%{_bindir}/taskadmin-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/boto.cfg
%ghost %{_sysconfdir}/alternatives/asadmin
%ghost %{_sysconfdir}/alternatives/bundle_image
%ghost %{_sysconfdir}/alternatives/cfadmin
%ghost %{_sysconfdir}/alternatives/cq
%ghost %{_sysconfdir}/alternatives/cwutil
%ghost %{_sysconfdir}/alternatives/dynamodb_dump
%ghost %{_sysconfdir}/alternatives/dynamodb_load
%ghost %{_sysconfdir}/alternatives/elbadmin
%ghost %{_sysconfdir}/alternatives/fetch_file
%ghost %{_sysconfdir}/alternatives/glacier
%ghost %{_sysconfdir}/alternatives/instance_events
%ghost %{_sysconfdir}/alternatives/kill_instance
%ghost %{_sysconfdir}/alternatives/launch_instance
%ghost %{_sysconfdir}/alternatives/list_instances
%ghost %{_sysconfdir}/alternatives/lss3
%ghost %{_sysconfdir}/alternatives/mturk
%ghost %{_sysconfdir}/alternatives/pyami_sendmail
%ghost %{_sysconfdir}/alternatives/route53
%ghost %{_sysconfdir}/alternatives/s3put
%ghost %{_sysconfdir}/alternatives/sdbadmin
%ghost %{_sysconfdir}/alternatives/taskadmin
%{python3_sitelib}/*

%files doc
%defattr(-,root,root,-)
%doc docs/BotoCheatSheet.pdf
%doc docs/build/html

%changelog
openSUSE Build Service is sponsored by