Editorial Workflows

dateutil module installer

unlisted workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: This workflow has no description.

Shared by: @hals_pg

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Show Alert ?
Title
Installer
Message
Installing the dateutil.
Button 1
OK
Output Value
ok
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
ON
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
ok
Run Python Script ?
Source Code
# -*- coding: utf-8 -*-
import sys
import os
import shutil
import requests
import zipfile
from StringIO import StringIO
import console
import imp


sys.setdefaultencoding('utf-8')

sp_path = os.path.join(os.environ['HOME'], 'Documents/site-packages')

try:
	os.chdir(sp_path)
except OSError:
	os.mkdir(sp_path)
	os.chdir(sp_path)

console.show_activity()
r = requests.get('https://github.com/dateutil/dateutil/archive/master.zip')
console.hide_activity()
z = zipfile.ZipFile(StringIO(r.content))
z.extractall()

org_dir = os.path.join(os.getcwd(), 'dateutil-master')
from_dir = os.path.join(os.getcwd(), 'dateutil-master/dateutil')
to_dir = os.path.join(os.getcwd(), 'dateutil')

shutil.copytree(from_dir, to_dir)
shutil.rmtree(org_dir)

try:
	imp.find_module('dateutil')
	console.hud_alert('Installation succeeded', 'success', 1.0)
except ImportError:
	console.hud_alert('Installation failed', 'error', 1.0)
…End If