Skip to content

Commit

Permalink
Move from flat-layout to src-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
gvalkov committed Feb 2, 2025
1 parent 3ff9816 commit cdb9c44
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 18 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ __pycache__
.pytest_cache
.ruff_cache

evdev/*.so
evdev/ecodes.c
evdev/ecodes.pyi
src/evdev/*.so
src/evdev/ecodes.c
src/evdev/ecodes.pyi
docs/_build
evdev/_ecodes.py
evdev/_input.py
evdev/_uinput.py
src/evdev/_ecodes.py
src/evdev/_input.py
src/evdev/_uinput.py
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The _ecodes extension module source file needs to be generated against the
# evdev headers of the running kernel. Refer to the 'build_ecodes' distutils
# command in setup.py.
exclude evdev/ecodes.c
include evdev/ecodes.py
exclude src/evdev/ecodes.c
include src/evdev/ecodes.py
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ classifiers = [
[project.urls]
"Homepage" = "https://github.com/gvalkov/python-evdev"

[tool.setuptools]
packages = ["evdev"]

[tool.ruff]
line-length = 120

Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


curdir = Path(__file__).resolve().parent
ecodes_c_path = curdir / "evdev/ecodes.c"
ecodes_c_path = curdir / "src/evdev/ecodes.c"


def create_ecodes(headers=None):
Expand Down Expand Up @@ -60,7 +60,7 @@ def create_ecodes(headers=None):

print("writing %s (using %s)" % (ecodes_c_path, " ".join(headers)))
with ecodes_c_path.open("w") as fh:
cmd = [sys.executable, "evdev/genecodes_c.py", "--ecodes", *headers]
cmd = [sys.executable, "src/evdev/genecodes_c.py", "--ecodes", *headers]
run(cmd, check=True, stdout=fh)


Expand Down Expand Up @@ -93,12 +93,12 @@ def generate_ecodes_py(self):
ecodes_py = Path(self.build_lib) / "evdev/ecodes.py"
print(f"writing {ecodes_py}")
with ecodes_py.open("w") as fh:
cmd = [sys.executable, "-B", "evdev/genecodes_py.py"]
cmd = [sys.executable, "-B", "src/evdev/genecodes_py.py"]
res = run(cmd, env={"PYTHONPATH": self.build_lib}, stdout=fh)

if res.returncode != 0:
print(f"failed to generate static {ecodes_py} - will use ecodes_runtime.py")
shutil.copy("evdev/ecodes_runtime.py", ecodes_py)
shutil.copy("src/evdev/ecodes_runtime.py", ecodes_py)

def run(self):
for cmd_name in self.get_sub_commands():
Expand All @@ -112,9 +112,9 @@ def run(self):
cflags = ["-std=c99", "-Wno-error=declaration-after-statement"]
setup(
ext_modules=[
Extension("evdev._input", sources=["evdev/input.c"], extra_compile_args=cflags),
Extension("evdev._uinput", sources=["evdev/uinput.c"], extra_compile_args=cflags),
Extension("evdev._ecodes", sources=["evdev/ecodes.c"], extra_compile_args=cflags),
Extension("evdev._input", sources=["src/evdev/input.c"], extra_compile_args=cflags),
Extension("evdev._uinput", sources=["src/evdev/uinput.c"], extra_compile_args=cflags),
Extension("evdev._ecodes", sources=["src/evdev/ecodes.c"], extra_compile_args=cflags),
],
cmdclass={
"build_ext": build_ext,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cdb9c44

Please sign in to comment.