Skip to content

Commit

Permalink
Merge pull request #281 from arista-eosplus/fix-rpmbuild
Browse files Browse the repository at this point in the history
Modify setup.py and ztpserver.spec to fix rpmbuild
  • Loading branch information
phil-dileo committed Jan 23, 2015
2 parents 9674884 + 214cd88 commit d31b0b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions rpm/ztpserver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ cp -rp $RPM_BUILD_DIR%{app_virtualenv_dir}/* $RPM_BUILD_ROOT%{app_virtualenv_dir
# Force some paths for install to handle the virtual_env case for RHEL
%{__install} -d $RPM_BUILD_ROOT%{python2_sitelib}
PYTHONPATH=$RPM_BUILD_ROOT%{python2_sitelib}:${PYTHONPATH} \
ZTPS_INSTALL_ROOT=$RPM_BUILD_ROOT \
python setup.py install --root=$RPM_BUILD_ROOT --install-scripts=%{_bindir} \
--install-lib=%{python2_sitelib}

Expand Down Expand Up @@ -163,6 +164,7 @@ chcon -Rv --type=httpd_sys_content_t %{_datadir}/ztpserver
%{_bindir}/ztps

%dir %{_sysconfdir}/ztpserver
%{_sysconfdir}/ztpserver/.VERSION
%config(noreplace) %{_sysconfdir}/ztpserver/ztpserver.conf
%config(noreplace) %{_sysconfdir}/ztpserver/ztpserver.wsgi
%config(noreplace) %{httpd_dir}/%{name}-wsgi.conf
Expand Down
17 changes: 14 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
from distutils.core import setup

def install():
return sys.argv[1:] == ['install']
if "install" in sys.argv:
return True
else:
return False

def join_url(x, y):
return '/' + '/'.join([z for z in x.split('/') + y.split('/') if z])

conf_path = config.CONF_PATH
install_path = config.INSTALL_PATH
Expand Down Expand Up @@ -103,7 +109,7 @@ def install():
file_list += [(filename.split('/')[-1],
'%s/actions' % install_path,
filename)]
for filename in glob('clent/lib/*'):
for filename in glob('client/lib/*'):
file_list += [(filename.split('/')[-1],
'%s/files/lib' % install_path,
filename)]
Expand Down Expand Up @@ -133,4 +139,9 @@ def install():

# hidden version file
if install():
shutil.copy('VERSION', config.VERSION_FILE_PATH)
custom_path = os.environ.get('ZTPS_INSTALL_ROOT')
if custom_path:
shutil.copy('VERSION', join_url(custom_path, config.VERSION_FILE_PATH))
else:
shutil.copy('VERSION', config.VERSION_FILE_PATH)

0 comments on commit d31b0b1

Please sign in to comment.