from setuptools import setup
import os
version = '0.3.0dev'

# Copy default config if not exists
raspi_sump_dir = '/home/pi/raspi-sump/'
conf_path = '{}raspisump.conf'.format(raspi_sump_dir)
chart_path = '{}charts/'.format(raspi_sump_dir)
log_path = '{}logs/'.format(raspi_sump_dir)
csv_path = '{}csv/'.format(raspi_sump_dir)
docs_path = '{}docs/'.format(raspi_sump_dir)
if os.path.isdir(raspi_sump_dir):
    print "I should not see this"
    print 'Updating install document for version {}'.format(version)
    cmd = 'cp -u docs/*.md ' + docs_path
    os.system(cmd)
    cmd = 'chown -R pi ' + raspi_sump_dir
    os.system(cmd)
else:
    print "make home directories"
    cmd = 'mkdir ' + raspi_sump_dir
    os.system(cmd)
    cmd = 'cp conf/raspisump.conf ' + conf_path
    os.system(cmd)
    cmd = 'chmod 700 ' + conf_path
    os.system(cmd)
    cmd = 'mkdir ' + chart_path
    os.system(cmd)
    cmd = 'mkdir ' + log_path
    os.system(cmd)
    cmd = 'mkdir ' + csv_path
    os.system(cmd)
    cmd = 'mkdir ' + docs_path
    os.system(cmd)
    cmd = 'cp docs/README.md ' + docs_path
    os.system(cmd)
    cmd = 'chown -R pi ' + raspi_sump_dir
    os.system(cmd)

config = {
    'description': 'Raspi-Sump',
    'author': 'Al Audet',
    'url': 'http://www.linuxnorth.org/raspi-sump/',
    'download_url': 'https://github.com/alaudet/raspi-sump/releases',
    'author_email': 'alaudet@linuxnorth.org.',
    'version': version,
    'install_requires': ['RPi.GPIO'],
    'packages': ['raspisump'],
    'scripts': [],
    'name': 'Raspi-Sump'
}

setup(**config)


# Finalize setup
install_dir = '/usr/local/lib/python2.7/dist-packages/raspisump/'
cmd = 'chmod +x ' + install_dir + '*.py'
os.system(cmd)
print ''
print "*************************************************************"
print "*See /home/pi/raspi-sump/docs for configuration information.*"
print "*************************************************************"
print ''
exit(0)

@@ -402,42 +402,8 @@
 r):%0A
-    print %22I should not see this%22%0A
     
@@ -598,42 +598,8 @@
 se:%0A
-    print %22make home directories%22%0A
     
@@ -1097,75 +1097,399 @@
 d)%0A%0A
-config = %7B%0A    'description': 'Raspi-Sump',%0A    'author': 'Al Audet
+raspi_sump_files = %5B'raspisump/raspisump.py',%0A                    'raspisump/raspisump_alternate.py',%0A                    'raspisump/todaychart.py',%0A                    'raspisump/checkpid.py'%0A                    %5D%0A%0Aconfig = %7B%0A    'name': 'Raspi-Sump',%0A    'description': 'A sump pit monitoring system for Raspberry Pi',%0A    'author': 'Al Audet',%0A    'author_email': 'alaudet@linuxnorth.org.
 ',%0A 
@@ -1613,55 +1613,8 @@
 s',%0A
-    'author_email': 'alaudet@linuxnorth.org.',%0A
     
@@ -1680,77 +1680,34 @@
    '
-packages': %5B'raspisump'%5D,%0A    'scripts': %5B%5D,%0A    'name': 'R
+scripts': r
 aspi
--Sump'
+_sump_files
 %0A%7D%0A%0A
@@ -1728,147 +1728,8 @@
 )%0A%0A%0A
-# Finalize setup%0Ainstall_dir = '/usr/local/lib/python2.7/dist-packages/raspisump/'%0Acmd = 'chmod +x ' + install_dir + '*.py'%0Aos.system(cmd)%0A
 prin
@@ -1956,12 +1956,4 @@
  ''%0A
-exit(0)%0A

Correct setup.py