Removed wget requirement

This commit is contained in:
Anthony Scemama 2014-04-07 15:45:19 +02:00
parent 346731bddc
commit 950876f794
3 changed files with 57 additions and 3 deletions

View File

@ -1,20 +1,22 @@
WWW_SERVER = http://qmcchem.ups-tlse.fr/files/scemama
IRPF90_TGZ = irpf90-latest-noarch-src.tar.gz
EZFIO_TGZ = EZFIO.latest.tar.gz
FETCH_FROM_WEB=./scripts/fetch_from_web.py
.PHONY: doc src
default: src
default:
./setup_environment.sh
EZFIO:
$(info ===== Fetching EZFIO from the web =====)
@wget "$(WWW_SERVER)/$(EZFIO_TGZ)" || \
@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(EZFIO_TGZ)" $(EZFIO_TGZ) || \
(echo Unable to download EZFIO : $(WWW_SERVER)/$(EZFIO_TGZ) ; exit 1)
@tar -zxf $(EZFIO_TGZ) && rm $(EZFIO_TGZ)
irpf90:
$(info ===== Fetching IRPF90 from the web =====)
@wget "$(WWW_SERVER)/$(IRPF90_TGZ)" || \
@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
(echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
@tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
$(MAKE) -C irpf90

33
scripts/fetch_from_web.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
import urllib
import sys
__author__ = "Anthony Scemama"
__date__ = "Mon Apr 7 15:30:29 CEST 2014"
"""Fetches a file from a given URL.
syntax : %s <URL> <local_filename>"""%(sys.argv[0])
# Check command line
if len(sys.argv) < 3:
print """
usage:
%s <URL> <local_filename>"""%(sys.argv[0])
URL = sys.argv[1]
filename = sys.argv[2]
webpage = urllib.urlopen(URL)
data = webpage.read()
if "404 - Not Found" in data:
print "Error in URL"
sys.exit(1)
file = open(filename,'w')
file.write(data)
file.close()

View File

@ -1,4 +1,8 @@
#!/bin/bash
#
# Setup script. Downloads IRPF90 and EZFIO if they are not already present in the current
# installation.
# Mon Apr 7 15:41:19 CEST 2014
QPACKAGE_ROOT=${PWD}
@ -8,6 +12,11 @@ if [[ -z ${IRPF90} ]] ;
then
make irpf90
IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90
if [[ ! -x ${QPACKAGE_ROOT}/irpf90/bin/irpf90 ]]
then
echo "Error in IRPF90 installation"
exit 1
fi
fi
cat << EOF > quantum_package.rc
@ -15,7 +24,17 @@ export IRPF90=${IRPF90}
export QPACKAGE_ROOT=${QPACKAGE_ROOT}
export PATH+=:\${QPACKAGE_ROOT}/scripts
export PATH+=:\${QPACKAGE_ROOT}/bin
export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache/"
EOF
source quantum_package.rc
if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]]
then
make EZFIO
fi
if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]]
then
echo "Error in IRPF90 installation"
exit 1
fi