
from subprocess import check_call
import urllib
import json
import os
import os.path

def install():
    with open('.bowerrc') as f:
        bowerrc = json.load(f)
    with open('bower.json') as f:
        bower_json = json.load(f)

    registry = 'https://bower.herokuapp.com'
    topdir = os.path.abspath(os.curdir)

    for pkg in bower_json['dependencies'].keys():
        req = urllib.urlopen('%s/packages/%s' % (registry, pkg))
        info = json.load(req)
        os.chdir(bowerrc['directory'])
        check_call(['git', 'clone', info['url']])
        os.chdir(pkg)
        install()
        os.chdir(topdir)


from subprocess import check_call
import urllib
import json
import os
import os.path

def install():
    with open('.bowerrc') as f:
        bowerrc = json.load(f)
    with open('bower.json') as f:
        bower_json = json.load(f)

    registry = 'https://bower.herokuapp.com'
    topdir = os.path.abspath(os.curdir)

    for pkg in bower_json['dependencies'].keys():
        req = urllib.urlopen('%s/packages/%s' % (registry, pkg))
        info = json.load(req)
        if not os.path.isdir(bowerrc['directory']):
            os.makedirs(bowerrc['directory'])
        os.chdir(bowerrc['directory'])
        check_call(['git', 'clone', info['url']])
        os.chdir(pkg)
        install()
        os.chdir(topdir)

Make the destination directory if it does not exist
Make the destination directory if it does not exist

  
  from subprocess import check_call
  import urllib
  import json
  import os
  import os.path
  
  def install():
      with open('.bowerrc') as f:
          bowerrc = json.load(f)
      with open('bower.json') as f:
          bower_json = json.load(f)
  
      registry = 'https://bower.herokuapp.com'
      topdir = os.path.abspath(os.curdir)
  
      for pkg in bower_json['dependencies'].keys():
          req = urllib.urlopen('%s/packages/%s' % (registry, pkg))
          info = json.load(req)
+         if not os.path.isdir(bowerrc['directory']):
+             os.makedirs(bowerrc['directory'])
          os.chdir(bowerrc['directory'])
          check_call(['git', 'clone', info['url']])
          os.chdir(pkg)
          install()
          os.chdir(topdir)
  
Make the destination directory if it does not exist
## Code Before:

from subprocess import check_call
import urllib
import json
import os
import os.path

def install():
    with open('.bowerrc') as f:
        bowerrc = json.load(f)
    with open('bower.json') as f:
        bower_json = json.load(f)

    registry = 'https://bower.herokuapp.com'
    topdir = os.path.abspath(os.curdir)

    for pkg in bower_json['dependencies'].keys():
        req = urllib.urlopen('%s/packages/%s' % (registry, pkg))
        info = json.load(req)
        os.chdir(bowerrc['directory'])
        check_call(['git', 'clone', info['url']])
        os.chdir(pkg)
        install()
        os.chdir(topdir)

## Instruction:
Make the destination directory if it does not exist
## Code After:

from subprocess import check_call
import urllib
import json
import os
import os.path

def install():
    with open('.bowerrc') as f:
        bowerrc = json.load(f)
    with open('bower.json') as f:
        bower_json = json.load(f)

    registry = 'https://bower.herokuapp.com'
    topdir = os.path.abspath(os.curdir)

    for pkg in bower_json['dependencies'].keys():
        req = urllib.urlopen('%s/packages/%s' % (registry, pkg))
        info = json.load(req)
        if not os.path.isdir(bowerrc['directory']):
            os.makedirs(bowerrc['directory'])
        os.chdir(bowerrc['directory'])
        check_call(['git', 'clone', info['url']])
        os.chdir(pkg)
        install()
        os.chdir(topdir)
