update.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. Propagare - 2018 - by psy (epsylon@riseup.net)
  5. -------
  6. You should have received a copy of the GNU General Public License along
  7. with Propagare; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. -------
  10. "A diferencia del odio, el amor se expande sin necesidad de propaganda."
  11. """
  12. import os
  13. from subprocess import PIPE
  14. from subprocess import Popen as execute
  15. class Updater(object):
  16. def __init__(self):
  17. GIT_REPOSITORY = "https://github.com/epsylon/propagare"
  18. rootDir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '../../', ''))
  19. if not os.path.exists(os.path.join(rootDir, ".git")):
  20. print " [Info] No se ha encontrado ningún respositorio: .git!\n"
  21. print "="*30
  22. print "\n Para hacer funcionar ésta opción, debes clonar Propagare mediante:\n"
  23. print " $ git clone %s" % GIT_REPOSITORY + "\n"
  24. else:
  25. checkout = execute("git checkout . && git pull", shell=True, stdout=PIPE, stderr=PIPE).communicate()[0]
  26. print checkout
  27. if not "Already up-to-date" in checkout:
  28. print "Enhorabuena!! Propagare se ha actualizado... ;-)\n"
  29. else:
  30. print "Propagare no necesita actualización... ;-)\n"