@@ -33,7 +33,6 @@ load(":whl_target_platforms.bzl", "whl_target_platforms")
3333
3434_CPPFLAGS = "CPPFLAGS"
3535_COMMAND_LINE_TOOLS_PATH_SLUG = "commandlinetools"
36- _WHEEL_ENTRY_POINT_PREFIX = "rules_python_wheel_entry_point"
3736
3837def _get_xcode_location_cflags (rctx , logger = None ):
3938 """Query the xcode sdk location to update cflags
@@ -443,38 +442,13 @@ def _whl_library_impl(rctx):
443442 )
444443 namespace_package_files = pypi_repo_utils .find_namespace_package_files (rctx , install_dir_path )
445444
446- # NOTE @aignas 2024-06-22: this has to live on until we stop supporting
447- # passing `twine` as a `:pkg` library via the `WORKSPACE` builds.
448- #
449- # See ../../packaging.bzl line 190
450- entry_points = {}
451- for item in metadata .entry_points :
452- name = item .name
453- module = item .module
454- attribute = item .attribute
455-
456- # There is an extreme edge-case with entry_points that end with `.py`
457- # See: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/java/com/google/devtools/build/lib/rules/python/PyBinaryConfiguredTargetTest.java#L174
458- entry_point_without_py = name [:- 3 ] + "_py" if name .endswith (".py" ) else name
459- entry_point_target_name = (
460- _WHEEL_ENTRY_POINT_PREFIX + "_" + entry_point_without_py
461- )
462- entry_point_script_name = entry_point_target_name + ".py"
463-
464- rctx .file (
465- entry_point_script_name ,
466- _generate_entry_point_contents (module , attribute ),
467- )
468- entry_points [entry_point_without_py ] = entry_point_script_name
469-
470445 build_file_contents = generate_whl_library_build_bazel (
471446 name = whl_path .basename ,
472447 sdist_filename = sdist_filename ,
473448 dep_template = rctx .attr .dep_template or "@{}{{name}}//:{{target}}" .format (
474449 rctx .attr .repo_prefix ,
475450 ),
476451 config_load = rctx .attr .config_load ,
477- entry_points = entry_points ,
478452 metadata_name = metadata .name ,
479453 metadata_version = metadata .version ,
480454 requires_dist = metadata .requires_dist ,
@@ -492,37 +466,12 @@ def _whl_library_impl(rctx):
492466 metadata = json .decode (rctx .read ("metadata.json" ))
493467 rctx .delete ("metadata.json" )
494468
495- # NOTE @aignas 2024-06-22: this has to live on until we stop supporting
496- # passing `twine` as a `:pkg` library via the `WORKSPACE` builds.
497- #
498- # See ../../packaging.bzl line 190
499- entry_points = {}
500- for item in metadata ["entry_points" ]:
501- name = item ["name" ]
502- module = item ["module" ]
503- attribute = item ["attribute" ]
504-
505- # There is an extreme edge-case with entry_points that end with `.py`
506- # See: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/java/com/google/devtools/build/lib/rules/python/PyBinaryConfiguredTargetTest.java#L174
507- entry_point_without_py = name [:- 3 ] + "_py" if name .endswith (".py" ) else name
508- entry_point_target_name = (
509- _WHEEL_ENTRY_POINT_PREFIX + "_" + entry_point_without_py
510- )
511- entry_point_script_name = entry_point_target_name + ".py"
512-
513- rctx .file (
514- entry_point_script_name ,
515- _generate_entry_point_contents (module , attribute ),
516- )
517- entry_points [entry_point_without_py ] = entry_point_script_name
518-
519469 namespace_package_files = pypi_repo_utils .find_namespace_package_files (rctx , rctx .path ("site-packages" ))
520470
521471 build_file_contents = generate_whl_library_build_bazel (
522472 name = whl_path .basename ,
523473 sdist_filename = sdist_filename ,
524474 dep_template = rctx .attr .dep_template or "@{}{{name}}//:{{target}}" .format (rctx .attr .repo_prefix ),
525- entry_points = entry_points ,
526475 # TODO @aignas 2025-05-17: maybe have a build flag for this instead
527476 enable_implicit_namespace_pkgs = rctx .attr .enable_implicit_namespace_pkgs ,
528477 # TODO @aignas 2025-04-14: load through the hub:
@@ -566,34 +515,6 @@ def _whl_library_impl(rctx):
566515
567516 return None
568517
569- def _generate_entry_point_contents (
570- module ,
571- attribute ,
572- shebang = "#!/usr/bin/env python3" ):
573- """Generate the contents of an entry point script.
574-
575- Args:
576- module (str): The name of the module to use.
577- attribute (str): The name of the attribute to call.
578- shebang (str, optional): The shebang to use for the entry point python
579- file.
580-
581- Returns:
582- str: A string of python code.
583- """
584- contents = """\
585- {shebang}
586- import sys
587- from {module} import {attribute}
588- if __name__ == "__main__":
589- sys.exit({attribute}())
590- """ .format (
591- shebang = shebang ,
592- module = module ,
593- attribute = attribute ,
594- )
595- return contents
596-
597518# NOTE @aignas 2024-03-21: The usage of dict({}, **common) ensures that all args to `dict` are unique
598519whl_library_attrs = dict ({
599520 "annotation" : attr .label (
0 commit comments