Skip to content

Commit

Permalink
Merge pull request #431 from takluyver/deprecate-default-setup-py
Browse files Browse the repository at this point in the history
Prepare for not generating setup.py by default
  • Loading branch information
takluyver committed Aug 12, 2021
2 parents 8d9af11 + e947be1 commit 0329523
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions flit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ def main(argv=None):
help="Select a format to build. Options: 'wheel', 'sdist'"
)

parser_build.add_argument('--no-setup-py', action='store_false', dest='setup_py',
parser_build.add_argument('--setup-py', action='store_true',
help=("Generate a setup.py file in the sdist. "
"The sdist will work with older tools that predate PEP 517. "
"This is the default for now, but will change in a future version."
)
)

parser_build.add_argument('--no-setup-py', action='store_true',
help=("Don't generate a setup.py file in the sdist. "
"The sdist will only work with tools that support PEP 517, "
"but the wheel will still be usable by any compatible tool."
Expand All @@ -95,7 +102,14 @@ def main(argv=None):
help="Select a format to publish. Options: 'wheel', 'sdist'"
)

parser_publish.add_argument('--no-setup-py', action='store_false', dest='setup_py',
parser_publish.add_argument('--setup-py', action='store_true',
help=("Generate a setup.py file in the sdist. "
"The sdist will work with older tools that predate PEP 517. "
"This is the default for now, but will change in a future version."
)
)

parser_publish.add_argument('--no-setup-py', action='store_true',
help=("Don't generate a setup.py file in the sdist. "
"The sdist will only work with tools that support PEP 517, "
"but the wheel will still be usable by any compatible tool."
Expand Down Expand Up @@ -148,11 +162,21 @@ def main(argv=None):
print(clogo.format(version=__version__))
sys.exit(0)

def gen_setup_py():
if not (args.setup_py or args.no_setup_py):
log.info("Adding generated setup.py to sdist by default.")
log.info(
"This will change in a future version. Pass --[no-]setup-py to "
"control it."
)
return True
return args.setup_py

if args.subcmd == 'build':
from .build import main
try:
main(args.ini_file, formats=set(args.format or []),
gen_setup_py=args.setup_py)
gen_setup_py=gen_setup_py())
except(common.NoDocstringError, common.VCSError, common.NoVersionError) as e:
sys.exit(e.args[0])
elif args.subcmd == 'publish':
Expand All @@ -161,7 +185,7 @@ def main(argv=None):
repository = args.repository or args.deprecated_repository
from .upload import main
main(args.ini_file, repository, formats=set(args.format or []),
gen_setup_py=args.setup_py)
gen_setup_py=gen_setup_py())

elif args.subcmd == 'install':
from .install import Installer
Expand Down

0 comments on commit 0329523

Please sign in to comment.