def __init__(self,
                 cfg_files=NotGiven,
                 module_name=NotGiven,
                 default_distribution=NotGiven,
                 guess_maintainer=NotGiven,
                 upstream_version=NotGiven,
                 has_ext_modules=NotGiven,
                 description=NotGiven,
                 long_description=NotGiven,
                 patch_file=None,
                 patch_level=None,
                 setup_requires=None,
                 debian_version=None,
                 have_script_entry_points = None,
                 use_setuptools = False,
                 guess_conflicts_provides_replaces = False,
                 sdist_dsc_command = None,
                 with_python2 = None,
                 with_python3 = None,
                 no_python2_scripts = None,
                 no_python3_scripts = None,
                 force_x_python3_version=False,
                 allow_virtualenv_install_location=False,
                 ):
        if cfg_files is NotGiven: raise ValueError("cfg_files must be supplied")
        if module_name is NotGiven: raise ValueError(
            "module_name must be supplied")
        if default_distribution is NotGiven: raise ValueError(
            "default_distribution must be supplied")
        if guess_maintainer is NotGiven: raise ValueError(
            "guess_maintainer must be supplied")
        if upstream_version is NotGiven: raise ValueError(
            "upstream_version must be supplied")
        if has_ext_modules is NotGiven: raise ValueError(
            "has_ext_modules must be supplied")
        if description is NotGiven: raise ValueError(
            "description must be supplied")
        if long_description is NotGiven: raise ValueError(
            "long_description must be supplied")

        cfg_defaults = self._make_cfg_defaults(
            module_name=module_name,
            default_distribution=default_distribution,
            guess_maintainer=guess_maintainer,
            )

        if len(cfg_files):
            check_cfg_files(cfg_files,module_name)

        cfg = ConfigParser.SafeConfigParser(cfg_defaults)
        for cfg_file in cfg_files:
            with codecs.open( cfg_file, mode='r', encoding='utf-8') as fd:
                cfg.readfp(fd)

        if sdist_dsc_command is not None:
            # Allow distutils commands to override config files (this lets
            # command line options beat file options).
            for longopt, shortopt, desc in stdeb_cfg_options:
                opt_name = longopt[:-1]
                name = opt_name.replace('-','_')
                value = getattr( sdist_dsc_command, name )
                if value is not None:
                    if not cfg.has_section(module_name):
                        cfg.add_section(module_name)
                    cfg.set( module_name, opt_name, value )

        self.stdeb_version = __stdeb_version__
        self.module_name = module_name
        self.source = parse_val(cfg,module_name,'Source')
        self.package = parse_val(cfg,module_name,'Package')
        self.package3 = parse_val(cfg,module_name,'Package3')
        forced_upstream_version = parse_val(cfg,module_name,
                                            'Forced-Upstream-Version')
        if forced_upstream_version == '':
            upstream_version_prefix = parse_val(cfg,module_name,
                                                'Upstream-Version-Prefix')
            upstream_version_suffix = parse_val(cfg,module_name,
                                                'Upstream-Version-Suffix')
            self.upstream_version = (upstream_version_prefix+
                                        debianize_version(upstream_version)+
                                        upstream_version_suffix)
        else:
            if (debianize_version(forced_upstream_version) !=
                forced_upstream_version):
                raise ValueError('forced upstream version ("%s") not a '
                                 'Debian-compatible version (e.g. "%s")'%(
                    forced_upstream_version,
                    debianize_version(forced_upstream_version)))
            self.upstream_version = forced_upstream_version
        self.epoch = parse_val(cfg,module_name,'Epoch')
        if self.epoch != '' and not self.epoch.endswith(':'):
            self.epoch = self.epoch + ':'
        self.packaging_version = parse_val(cfg,module_name,'Debian-Version')
        if debian_version is not None:
            # command-line arg overrides file
            self.packaging_version = debian_version
        self.dsc_version = '%s-%s'%(
            self.upstream_version,
            self.packaging_version)
        self.full_version = '%s%s-%s'%(
            self.epoch,
            self.upstream_version,
            self.packaging_version)
        self.distname = parse_val(cfg,module_name,'Suite')
        self.maintainer = ', '.join(parse_vals(cfg,module_name,'Maintainer'))
        self.uploaders = parse_vals(cfg,module_name,'Uploaders')
        self.date822 = get_date_822()

        build_deps = []
        if use_setuptools:
            if with_python2:
                build_deps.append('python-setuptools (>= 0.6b3)')
            if with_python3:
                build_deps.append('python3-setuptools')
        if setup_requires is not None and len(setup_requires):
            build_deps.extend(
                get_deb_depends_from_setuptools_requires(setup_requires))

        depends = ['${misc:Depends}', '${python:Depends}']
        depends3 = ['${misc:Depends}', '${python3:Depends}']
        need_custom_binary_target = False

        if has_ext_modules:
            self.architecture = 'any'
            if with_python2:
                build_deps.append('python-all-dev (>= %s)'%PYTHON_ALL_MIN_VERS)
            depends.append('${shlibs:Depends}')

            self.architecture3 = 'any'
            if with_python3:
                build_deps.append('python3-all-dev')
            depends3.append('${shlibs:Depends}')

        else:
            self.architecture = 'all'
            if with_python2:
                build_deps.append('python-all (>= %s)'%PYTHON_ALL_MIN_VERS)

            self.architecture3 = 'all'
            if with_python3:
                build_deps.append('python3-all')

        self.copyright_file = parse_val(cfg,module_name,'Copyright-File')
        self.mime_file = parse_val(cfg,module_name,'MIME-File')

        self.shared_mime_file = parse_val(cfg,module_name,'Shared-MIME-File')

        if self.mime_file == '' and self.shared_mime_file == '':
            self.dh_installmime_indep_line = ''
        else:
            need_custom_binary_target = True
            self.dh_installmime_indep_line = '\tdh_installmime'

        mime_desktop_files = parse_vals(cfg,module_name,'MIME-Desktop-Files')
        if len(mime_desktop_files):
            need_custom_binary_target = True
            self.dh_desktop_indep_line = '\tdh_desktop'
        else:
            self.dh_desktop_indep_line = ''

        #    E. any mime .desktop files
        self.install_file_lines = []
        for mime_desktop_file in mime_desktop_files:
            self.install_file_lines.append(
                '%s usr/share/applications'%mime_desktop_file)

        depends.extend(parse_vals(cfg,module_name,'Depends') )
        depends3.extend(parse_vals(cfg,module_name,'Depends3') )
        self.depends = ', '.join(depends)
        self.depends3 = ', '.join(depends3)

        self.debian_section = parse_val(cfg,module_name,'Section')

        self.description = re.sub('\s+', ' ', description).strip()
        if long_description != 'UNKNOWN':
            ld2=[]
            for line in long_description.split('\n'):
                ls = line.strip()
                if len(ls):
                    ld2.append(' '+line)
                else:
                    ld2.append(' .')
            ld2 = ld2[:20]
            self.long_description = '\n'.join(ld2)
        else:
            self.long_description = ''

        if have_script_entry_points:
            build_deps.append( 'debhelper (>= %s)'%DH_IDEAL_VERS )
        else:
            build_deps.append( 'debhelper (>= %s)'%DH_MIN_VERS )

        build_deps.extend( parse_vals(cfg,module_name,'Build-Depends') )
        self.build_depends = ', '.join(build_deps)

        suggests = ', '.join( parse_vals(cfg,module_name,'Suggests') )
        suggests3 = ', '.join( parse_vals(cfg,module_name,'Suggests3') )
        recommends = ', '.join( parse_vals(cfg,module_name,'Recommends') )
        recommends3 = ', '.join( parse_vals(cfg,module_name,'Recommends3') )

        self.source_stanza_extras = ''

        build_conflicts = parse_vals(cfg,module_name,'Build-Conflicts')
        if len(build_conflicts):
            self.source_stanza_extras += ('Build-Conflicts: '+
                                              ', '.join( build_conflicts )+'\n')

        self.patch_file = parse_val(cfg,module_name,'Stdeb-Patch-File')

        if patch_file is not None:
            if self.patch_file != '':
                raise RuntimeError('A patch file was specified on the command '
                                   'line and in .cfg file.')
            else:
                self.patch_file = patch_file

        self.patch_level = parse_val(cfg,module_name,'Stdeb-Patch-Level')
        if self.patch_level != '':
            if patch_level is not None:
                raise RuntimeError('A patch level was specified on the command '
                                   'line and in .cfg file.')
            else:
                self.patch_level = int(self.patch_level)
        else:
            if patch_level is not None:
                self.patch_level = patch_level
            else:
                self.patch_level = 0

        xs_python_version = parse_vals(cfg,module_name,'XS-Python-Version')

        if len(xs_python_version)!=0:
            self.source_stanza_extras += ('X-Python-Version: '+
                                          ', '.join(xs_python_version)+'\n')

        x_python3_version = parse_vals(cfg,module_name,'X-Python3-Version')
        x_python3_version = [v.strip('"') for v in x_python3_version]

        if len(x_python3_version)!=0:
            self.source_stanza_extras += ('X-Python3-Version: '+
                                          ', '.join(x_python3_version)+'\n')

        dpkg_shlibdeps_params = parse_val(
            cfg,module_name,'dpkg-shlibdeps-params')
        if dpkg_shlibdeps_params:
            need_custom_binary_target = True
            self.dh_binary_arch_lines = """\tdh binary-arch --before dh_shlibdeps
\tdh_shlibdeps -a --dpkg-shlibdeps-params=%s
\tdh binary --after dh_shlibdeps"""%dpkg_shlibdeps_params
        else:
            self.dh_binary_arch_lines = '\tdh binary-arch'
        self.dh_binary_indep_lines = '\tdh binary-indep'

        conflicts = parse_vals(cfg,module_name,'Conflicts')
        conflicts3 = parse_vals(cfg,module_name,'Conflicts3')
        provides = parse_vals(cfg,module_name,'Provides')
        provides3 = parse_vals(cfg,module_name,'Provides3')
        replaces = parse_vals(cfg,module_name,'Replaces')
        replaces3 = parse_vals(cfg,module_name,'Replaces3')

        if guess_conflicts_provides_replaces:
            # Find list of binaries which we will conflict/provide/replace.

            cpr_binaries = set()

            # Get original Debian information for the package named the same.
            for version_info in apt_cache_info('showsrc',self.package):

                # Remember each of the binary packages produced by the Debian source
                for binary in version_info['Binary']:
                    cpr_binaries.add(binary)

                # TODO: do this for every version available , just the
                # first, or ???
                break

            # Descend each of the original binaries and see what
            # packages they conflict/ provide/ replace:
            for orig_binary in cpr_binaries:
                for version_info in apt_cache_info('show',orig_binary):
                    provides.extend( version_info['Provides'])
                    provides3.extend( version_info['Provides'])
                    conflicts.extend(version_info['Conflicts'])
                    conflicts3.extend(version_info['Conflicts'])
                    replaces.extend( version_info['Replaces'])
                    replaces3.extend( version_info['Replaces'])

            if self.package in cpr_binaries:
                cpr_binaries.remove(self.package) # don't include ourself

            cpr_binaries = list(cpr_binaries) # convert to list

            conflicts.extend( cpr_binaries )
            conflicts3.extend( cpr_binaries )
            provides.extend( cpr_binaries )
            provides3.extend( cpr_binaries )
            replaces.extend( cpr_binaries )
            replaces3.extend( cpr_binaries )

            # round-trip through set to get unique entries
            conflicts = list(set(conflicts))
            conflicts3 = list(set(conflicts3))
            provides = list(set(provides))
            provides3 = list(set(provides3))
            replaces = list(set(replaces))
            replaces3 = list(set(replaces3))

        self.package_stanza_extras = ''
        self.package_stanza_extras3 = ''

        if len(conflicts):
            self.package_stanza_extras += ('Conflicts: '+
                                              ', '.join( conflicts )+'\n')
        if len(conflicts3):
            self.package_stanza_extras3 += ('Conflicts: '+
                                              ', '.join( conflicts3 )+'\n')

        if len(provides):
            self.package_stanza_extras += ('Provides: '+
                                             ', '.join( provides  )+'\n')

        if len(provides3):
            self.package_stanza_extras3 += ('Provides: '+
                                             ', '.join( provides3  )+'\n')

        if len(replaces):
            self.package_stanza_extras += ('Replaces: ' +
                                              ', '.join( replaces  )+'\n')
        if len(replaces3):
            self.package_stanza_extras3 += ('Replaces: ' +
                                              ', '.join( replaces3 )+'\n')
        if len(recommends):
            self.package_stanza_extras += ('Recommends: '+recommends+'\n')

        if len(recommends3):
            self.package_stanza_extras3 += ('Recommends: '+recommends3+'\n')

        if len(suggests):
            self.package_stanza_extras += ('Suggests: '+suggests+'\n')

        if len(suggests3):
            self.package_stanza_extras3 += ('Suggests: '+suggests3+'\n')

        self.dirlist = ""

        if not (with_python2 or with_python3):
            raise RuntimeError('nothing to do - neither Python 2 or 3.')
        sequencer_with = []
        if with_python2:
            sequencer_with.append('python2')
        if with_python3:
            sequencer_with.append('python3')
        num_binary_packages = len(sequencer_with)

        no_script_lines=[]

        if no_python2_scripts:
            # install to a location where debian tools do not find them
            self.no_python2_scripts_cli_args = '--install-scripts=/trash'
            no_script_lines.append(
                'rm -rf debian/%s/trash'%(self.package,))
        else:
            self.no_python2_scripts_cli_args = ''
        if no_python3_scripts:
            # install to a location where debian tools do not find them
            self.no_python3_scripts_cli_args = '--install-scripts=/trash'
            no_script_lines.append(
                'rm -rf debian/%s/trash'%(self.package3,))
        else:
            self.no_python3_scripts_cli_args = ''

        self.scripts_cleanup = '\n'.join(['        '+s for s in no_script_lines])

        if sys.prefix != '/usr':
            if not allow_virtualenv_install_location:
                # virtualenv will set distutils
                # --prefix=/path/to/virtualenv, but unless explicitly
                # requested, we want to install into /usr.
                self.install_prefix = '--prefix=/usr'
            else:
                self.install_prefix = '--prefix=%s' % sys.prefix
        else:
            self.install_prefix = ''

        rules_override_clean_target_pythons = []
        rules_override_build_target_pythons = []
        rules_override_install_target_pythons = []
        if with_python2:
            rules_override_clean_target_pythons.append(
                RULES_OVERRIDE_CLEAN_TARGET_PY2%self.__dict__
                )
            rules_override_build_target_pythons.append(
                RULES_OVERRIDE_BUILD_TARGET_PY2%self.__dict__
                )
            rules_override_install_target_pythons.append(
                RULES_OVERRIDE_INSTALL_TARGET_PY2%self.__dict__
                )
        if with_python3:
            rules_override_clean_target_pythons.append(
                RULES_OVERRIDE_CLEAN_TARGET_PY3%self.__dict__
                )
            rules_override_build_target_pythons.append(
                RULES_OVERRIDE_BUILD_TARGET_PY3%self.__dict__
                )
            rules_override_install_target_pythons.append(
                RULES_OVERRIDE_INSTALL_TARGET_PY3%self.__dict__
                )
        self.rules_override_clean_target_pythons = '\n'.join(rules_override_clean_target_pythons)
        self.rules_override_build_target_pythons = '\n'.join(rules_override_build_target_pythons)
        self.rules_override_install_target_pythons = '\n'.join(rules_override_install_target_pythons)

        self.override_dh_auto_clean = RULES_OVERRIDE_CLEAN_TARGET%self.__dict__
        self.override_dh_auto_build = RULES_OVERRIDE_BUILD_TARGET%self.__dict__
        self.override_dh_auto_install = RULES_OVERRIDE_INSTALL_TARGET%self.__dict__

        if force_x_python3_version and with_python3 and x_python3_version and \
                x_python3_version[0]:
            # override dh_python3 target to modify the dependencies
            # to ensure that the passed minimum X-Python3-Version is usedby
            version = x_python3_version[0]
            if not version.endswith('~'):
                version += '~'
            self.override_dh_python3 = RULES_OVERRIDE_PYTHON3%{
                'scripts': (
                    '        sed -i ' +
                    '"s/\([ =]python3:any (\)>= [^)]*\()\)/\\1%s\\2/g" ' +
                    'debian/%s.substvars') % (version, self.package3)
            }
        else:
            self.override_dh_python3 = ''

        sequencer_options = ['--with '+','.join(sequencer_with)]
        sequencer_options.append('--buildsystem=python_distutils')
        self.sequencer_options = ' '.join(sequencer_options)

        setup_env_vars = parse_vals(cfg,module_name,'Setup-Env-Vars')
        self.exports = ""
        if len(setup_env_vars):
            self.exports += '\n'
            self.exports += '#exports specified using stdeb Setup-Env-Vars:\n'
            self.exports += '\n'.join(['export %s'%v for v in setup_env_vars])
            self.exports += '\n'
        self.udev_rules = parse_val(cfg,module_name,'Udev-Rules')

        if need_custom_binary_target:
            if self.architecture == 'all':
                self.binary_target_lines = ( \
                    self.__dict__%RULES_BINARY_ALL_TARGET + \
                    RULES_BINARY_INDEP_TARGET%self.__dict__ )
            else:
                self.binary_target_lines = ( \
                    RULES_BINARY_TARGET%self.__dict__ + \
                    RULES_BINARY_INDEP_TARGET%self.__dict__ + \
                    RULES_BINARY_ARCH_TARGET%self.__dict__ )
        else:
            self.binary_target_lines = ''

        if with_python2:
            self.control_py2_stanza = CONTROL_PY2_STANZA%self.__dict__
        else:
            self.control_py2_stanza = ''

        if with_python3:
            self.control_py3_stanza = CONTROL_PY3_STANZA%self.__dict__
        else:
            self.control_py3_stanza = ''

        self.with_python2 = with_python2
        self.with_python3 = with_python3
        self.no_python2_scripts = no_python2_scripts
        self.no_python3_scripts = no_python3_scripts
dataset/ETHPy150Open astraw/stdeb/stdeb/util.py/DebianInfo.__init__/swapped operands of `%`