# BEGIN SourceDeps(oneline):
BuildRequires: python-base python-module-gdal python-modules python2.7(django) python2.7(django.apps) python2.7(django.conf) python2.7(django.conf.urls) python2.7(django.contrib) python2.7(django.contrib.auth) python2.7(django.contrib.auth.decorators) python2.7(django.contrib.auth.models) python2.7(django.core.exceptions) python2.7(django.core.mail) python2.7(django.core.mail.backends.smtp) python2.7(django.core.management) python2.7(django.core.paginator) python2.7(django.core.urlresolvers) python2.7(django.core.wsgi) python2.7(django.db) python2.7(django.db.models) python2.7(django.db.models.deletion) python2.7(django.dispatch) python2.7(django.forms) python2.7(django.http) python2.7(django.shortcuts) python2.7(django.template) python2.7(django.template.loader) python2.7(django.test) python2.7(django.utils)
BuildRequires: python2.7(django.utils.crypto) python2.7(django.utils.decorators) python2.7(django.utils.safestring) python2.7(django.utils.translation) python2.7(django.views.decorators.cache) python2.7(django.views.decorators.http) python2.7(django.views.generic) python2.7(django.views.generic.base) python2.7(http) python2.7(json) python2.7(logging) python2.7(mptt) python2.7(mptt.models) python2.7(multiprocessing) python2.7(pytz) python2.7(reportlab.graphics) python2.7(reportlab.graphics.barcode) python2.7(reportlab.graphics.shapes) python2.7(reportlab.pdfgen)
# END SourceDeps(oneline)
%define _unpackaged_files_terminate_build 1

Name: severcart
Version: 0.5.3
Release: alt0.1
Summary: application for control of expendables with simple interface
Summary(ru_RU.UTF-8): приложение для управления расходными материалами с простым интерфейсом
Group: Databases
License: GPL v2

Source0: %{name}-%{version}.tar.gz
Source1: %{name}-2.4.conf
BuildArch: noarch

BuildRequires(pre): rpm-macros-apache2
BuildRequires: webserver-common rpm-build-webserver-common

#BuildRequires: 
#Django
#django-debug-toolbar
#django-mptt
#lxml==3.4.4
#Pillow
#psycopg2
#python-docx
#sqlparse
#reportlab
#pytz

%description
Severcart is intended for monitoring over refillings and
relocation of cartridges for laser and inkjet printers of different vendors.
The interface provided to web allows to create different reports on an
expenditure of expendables, to obtain up-to-date information about existence
them in a warehouse, to carry history of refillings, to generate acts of
accepting/transmission. Also for automation of operation support of scanners a
dash of codes is realized.

%description -l ru_RU.UTF-8
Severcart предназначен для контроля за перезаправками и
перемещениями картриджей для лазерных и струйных принтеров различных
производителей. Предоставляемый web интерфейс позволяет создавать различные
отчёты по расходованию расходных материалов, получать актуальную информацию о
наличии их на складе, вести историю перезаправок, генерировать акты
приёмки/передачи. Также для автоматизации работы реализована поддержка сканеров
штрих кодов.

%if_with python3
%package -n python3-module-%name
%else
%package -n python-module-%name
%endif
Group: Development/Python
Summary: python modules for %name

%if_with python3
%description -n python3-module-%name
%else
%description -n python-module-%name
%endif
python modules for Severcart.

%prep
%setup -q -n %{name}-%{version}

%build
#django-admin compilemessages
%if_with python3
#python3_build
%else
#python_build
%endif

%install
%if_with python3
%python3_install
%else
#python_install
%endif

# drop httpd-conf snippet
install -m 0644 -D -p %SOURCE1 %buildroot%apache2_sites_available/%name.conf
mkdir -p %buildroot%apache2_sites_enabled
touch %buildroot%apache2_sites_enabled/%name.conf

install -d -m 755 %buildroot%_datadir/%name
install -d -m 755 %buildroot%_sharedstatedir/%name
#install -d -m 755 %buildroot%_sysconfdir/%name

# Copy everything to /usr/share
#mv %buildroot%python_sitelibdir/%name \
#   %buildroot%_datadir/%name
cp -a */ %buildroot%_datadir/%name/
cp manage.py %buildroot%_datadir/%name
rm -rf %buildroot%python_sitelibdir/%name

# remove unnecessary .po files
find %buildroot -name django.po -exec rm '{}' \;
find %buildroot -name djangojs.po -exec rm '{}' \;

# Move config to /etc, symlink it back to /usr/share
#mv %buildroot%_datadir/%name/openstack_dashboard/local/local_settings.py.example %buildroot%_sysconfdir/%name/local_settings
#ln -s ../../../../../%_sysconfdir/%name/local_settings %buildroot%_datadir/%name/openstack_dashboard/local/local_settings.py

#cp conf/*.json %buildroot%_sysconfdir/%name/

# create /var/run/%name/ and own it
mkdir -p %buildroot%_runtimedir/%name

%pre -n %name
%_sbindir/groupadd -r -f %name 2>/dev/null ||:
%_sbindir/useradd -r -g %name -G _webserver -c 'Severcart server' \
        -s /sbin/nologin  -d %_sharedstatedir/%name %name 2>/dev/null ||:

%files
%doc README.md LICENSE docs
#python_sitelibdir/%name
#python_sitelibdir/%name-*.egg-info
%_datadir/%name
#%dir %attr(0750, root, _webserver) %_sysconfdir/%name
%dir %attr(0770, root, _webserver) %_sharedstatedir/%name
%config(noreplace) %apache2_sites_available/*.conf
%ghost %apache2_sites_enabled/*.conf
#%config(noreplace) %attr(0640, root, _webserver) %_sysconfdir/%name/local_settings
#%config(noreplace) %attr(0640, root, _webserver) %_sysconfdir/%name/*.json

%if_with python3
#files -n python3-module-%name
#%python3_sitelibdir/*
#%exclude %python3_sitelibdir/*/*/testing_utils
#%exclude %python3_sitelibdir/*/examples
%else
#files -n python-module-%name
#%python_sitelibdir/*
#%exclude %python_sitelibdir/*/*/testing_utils
#%exclude %python_sitelibdir/*/examples
%endif

%changelog
* Thu Nov 24 2016 Igor Vlasenko <viy@altlinux.ru> 0.5.3-alt0.1
- initial import by package builder

