
import ConfigParser

universal = False

setup_cfg = ConfigParser.SafeConfigParser()
setup_cfg.read("setup.cfg")
if setup_cfg.has_section("wheel"):
    universal = setup_cfg.getboolean("wheel", "universal")
if universal:
    print("py2.py3")
else:
    print("py2")


import ConfigParser

universal = False

setup_cfg = ConfigParser.SafeConfigParser()
setup_cfg.read("setup.cfg")
if setup_cfg.has_option("wheel", "universal"):
    universal = setup_cfg.getboolean("wheel", "universal")
if universal:
    print("py2.py3")
else:
    print("py2")

Fix universal extraction in non-universal wheel
Fix universal extraction in non-universal wheel

The pypi-extract-universal.py would raise ConfigParser.NoOptionError
when inspecting a setup.cfg with a wheel section but no universal
option. Guard against this by actually testing whether the option is
there rather than merely whether the section exists.

Change-Id: I7a907464e5b1dc211c7e4c4c2f3e6375b7a6085d

  
  import ConfigParser
  
  universal = False
  
  setup_cfg = ConfigParser.SafeConfigParser()
  setup_cfg.read("setup.cfg")
- if setup_cfg.has_section("wheel"):
+ if setup_cfg.has_option("wheel", "universal"):
      universal = setup_cfg.getboolean("wheel", "universal")
  if universal:
      print("py2.py3")
  else:
      print("py2")
  
Fix universal extraction in non-universal wheel
## Code Before:

import ConfigParser

universal = False

setup_cfg = ConfigParser.SafeConfigParser()
setup_cfg.read("setup.cfg")
if setup_cfg.has_section("wheel"):
    universal = setup_cfg.getboolean("wheel", "universal")
if universal:
    print("py2.py3")
else:
    print("py2")

## Instruction:
Fix universal extraction in non-universal wheel
## Code After:

import ConfigParser

universal = False

setup_cfg = ConfigParser.SafeConfigParser()
setup_cfg.read("setup.cfg")
if setup_cfg.has_option("wheel", "universal"):
    universal = setup_cfg.getboolean("wheel", "universal")
if universal:
    print("py2.py3")
else:
    print("py2")
