Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add entry_point & setuptools-git, disable "create_init_files" #371

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pip/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ py_binary(
srcs = ["assemble.py"],
deps = [
vaticle_bazel_distribution_requirement("setuptools"),
vaticle_bazel_distribution_requirement("setuptools-git"),
vaticle_bazel_distribution_requirement("wheel")
],
visibility = ["//visibility:public"]
Expand Down
11 changes: 0 additions & 11 deletions pip/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
from setuptools.sandbox import run_setup


def create_init_files(directory):
from os import walk
from os.path import join
for dirName, subdirList, fileList in walk(directory):
if "__init__.py" not in fileList:
open(join(dirName, "__init__.py"), "w").close()


parser = argparse.ArgumentParser()
parser.add_argument('--output_sdist', help="Output archive")
parser.add_argument('--output_wheel', help="Output archive")
Expand Down Expand Up @@ -110,9 +102,6 @@ def create_init_files(directory):
# change directory into new package root
os.chdir(pkg_dir)

# ensure every folder is a Python package
create_init_files(pkg_dir)

# pack sources
run_setup(setup_py, ['sdist', 'bdist_wheel'])

Expand Down
1 change: 1 addition & 0 deletions pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ urllib3==1.26.14
webencodings==0.5.1
wheel==0.38.4
zipp==3.11.0
setuptools-git==1.2
4 changes: 4 additions & 0 deletions pip/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _assemble_pip_impl(ctx):
"{license}": ctx.attr.license,
"{long_description_file}": ctx.file.long_description_file.path,
"{python_requires}": ctx.attr.python_requires,
"{entry_points}": str(ctx.attr.entry_points),
},
)

Expand Down Expand Up @@ -285,6 +286,9 @@ assemble_pip = rule(
default = ">0",
doc = "If your project only runs on certain Python versions, setting the python_requires argument to the appropriate PEP 440 version specifier string will prevent pip from installing the project on other Python versions.",
),
"entry_points": attr.string_list_dict(
doc = "entry_points for setuptools."
),
"_setup_py_template": attr.label(
allow_single_file = True,
default = "//pip/templates:setup.py",
Expand Down
3 changes: 2 additions & 1 deletion pip/templates/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
install_requires=INSTALL_REQUIRES_PLACEHOLDER,
zip_safe=False,
python_requires="{python_requires}",
setup_requires=["wheel"]
entry_points={entry_points},
setup_requires=["setuptools-git", "wheel"]
)