def handle(self, *args, **options):
        if len(args)==0:
            # with no param, we use the default profile, that is defined in the settings
            profile_name = settings.DOJO_BUILD_PROFILE
        else:
            profile_name = args[0]
        profile = self._get_profile(profile_name)
        used_src_version = profile['used_src_version'] % {'DOJO_BUILD_VERSION': settings.DOJO_BUILD_VERSION} # no dependencies to project's settings.py file!
        # used by minify_extreme!
        self.skip_files = profile.get("minify_extreme_skip_files", ())
        self.dojo_base_dir = "%(dojo_root)s/%(version)s" % \
                             {'dojo_root':settings.BASE_DOJO_ROOT, 
                             'version':used_src_version}
        # does the defined dojo-directory exist?
        util_base_dir = "%(dojo_base_dir)s/util" % {'dojo_base_dir':self.dojo_base_dir}
        if not os.path.exists(util_base_dir):
            raise CommandError('Put the the dojo source files (version \'%(version)s\') in the folder \'%(folder)s/%(version)s\' or set a different version in settings.DOJANGO_DOJO_BUILD_VERSION' % \
                               {'version':used_src_version,
                                'folder':settings.BASE_DOJO_ROOT})
        # check, if java is installed
        try:
            # ignoring output of the java call
            subprocess.call(settings.DOJO_BUILD_JAVA_EXEC, stdout=subprocess.PIPE) # will work with python >= 2.4
        except:
            raise CommandError('Please install java. You need it for building dojo.')
        buildscript_dir = os.path.abspath('%s/buildscripts' % util_base_dir)
        if version_tuple(settings.DOJO_BUILD_USED_VERSION) < (1,2,0):
            executable = '%(java_exec)s -jar ../shrinksafe/custom_rhino.jar build.js' % \
                         {'java_exec':settings.DOJO_BUILD_JAVA_EXEC}
        else:
            # use the new build command line call!
            if(os.path.sep == "\\"):
                executable = 'build.bat'
            else:
                executable = './build.sh'
                # force executable rights!
                os.chmod(os.path.join(buildscript_dir, 'build.sh'), 0755)
        # use the passed version for building
        version = options.get('build_version', None)
        if not version:
            # if no option --build_version was passed, we use the default build version
            version = profile['build_version'] % {'DOJO_BUILD_VERSION': settings.DOJO_BUILD_VERSION} # no dependencies to project's settings.py file!
        # we add the version to our destination base path
        self.dojo_release_dir = '%(base_path)s/%(version)s' % {
                          'base_path':profile['base_root'] % {'BASE_MEDIA_ROOT':settings.BASE_MEDIA_ROOT},
                          'version':version} # we don't want to have a dependancy to the project's settings file!
        release_dir = os.path.abspath(os.path.join(self.dojo_release_dir, "../"))
        # the build command handling is so different between the versions!
        # sometimes we need to add /, sometimes not :-(
        if version_tuple(settings.DOJO_BUILD_USED_VERSION) < (1,2,0):
            release_dir = release_dir + os.path.sep
        # setting up the build command
        build_addons = ""
        if version_tuple(settings.DOJO_BUILD_USED_VERSION) >= (1,2,0):
            # since version 1.2.0 there is an additional commandline option that does the mini build (solved within js!)
            build_addons = "mini=true"
        exe_command = 'cd "%(buildscript_dir)s" && %(executable)s version=%(version)s releaseName="%(version)s" releaseDir="%(release_dir)s" %(options)s %(build_addons)s' % \
                      {'buildscript_dir':buildscript_dir,
                       'executable':executable,
                       'version':version,
                       'release_dir':release_dir,
                       'options':profile['options'] % {'BASE_MEDIA_ROOT':settings.BASE_MEDIA_ROOT},
                       'build_addons':build_addons}
        # print exe_command
        minify = options['minify']
        minify_extreme = options['minify_extreme']
        prepare_zipserve = options['prepare_zipserve']
        if (version_tuple(settings.DOJO_BUILD_USED_VERSION) < (1,2,0)) and (minify or minify_extreme):
            self._dojo_mini_before_build()
        if sys.platform == 'win32': # fixing issue #39, if dojango is installed on a different drive
            exe_command = os.path.splitdrive(buildscript_dir)[0] + ' && ' + exe_command
        
        # do the build
        exit_code = os.system(exe_command)
        if exit_code: # != 0
            sys.exit(1) # dojobuild exits because of shrinksafe error
        if version_tuple(settings.DOJO_BUILD_USED_VERSION) < (1,2,0):
            if minify or minify_extreme:
                self._dojo_mini_after_build()
        if minify_extreme:
            self._dojo_mini_extreme()
        if prepare_zipserve:
            self._dojo_prepare_zipserve()
dataset/ETHPy150Open klipstein/dojango/dojango/management/commands/dojobuild.py/Command.handle/original