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

Demonstration: fixes the pywatchman build script and documents how to publish an updated version to pypi #1074

Open
wants to merge 3 commits into
base: main
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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ buck-cache
/config.sub
/config.guess
/configure.lineno
/python/build
/python/dist/
watchman/python/build
watchman/python/dist/
/watchman/python/pywatchman.egg-info/
**/*.egg-info
*.pyc
*.pyd
*.so
Expand Down Expand Up @@ -98,3 +99,4 @@ cppclient/watchmanclient.pc
/external
/common
/eden
wheelhouse
48 changes: 40 additions & 8 deletions watchman/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# Build/Upload Notes:
# - The build would not run from a personal clone, only from a direct clone of the
# facebook repo. All changes were made to that checkout and then pushed to my
# clone.
# - cibuildwheel was used to generate the distributions that were published, from
# the top level directory:
# cibuildwheel --platform macos watchman/python
# cibuildwheel --platform linux watchman/python
# pipx run build --sdist watchman/python
# - twine was used to publish the artefacts:
# twine upload wheelhouse/* watchman/python/dist/*



import os

Expand All @@ -15,7 +28,7 @@

watchman_src_dir = os.environ.get("CMAKE_CURRENT_SOURCE_DIR")
if watchman_src_dir is None:
watchman_src_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
watchman_src_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..")

# Setuptools is very picky about the path on Windows. They have to be relative
# paths, and on Windows that means we have to be on the same drive as the source
Expand All @@ -27,23 +40,42 @@
os.chdir(py_dir)
py_dir = os.path.relpath(py_dir)

long_description = """Connect and query Watchman to discover file changes.

This is an unofficial release that aims to make a recent version of pywatchman
available to python projects.

Specifically, Django depends on pywatchman to have a modern autoreload process,
but recent changes to the core watchman process has meant that the latest offical
release of pywatchman (2017 - v1.4.2) no longer works. Luckily, Django falls back
to the slower StatReloader, but we've found that to have unacceptable performance
in large projects.

The Facebook response to issues, particularly on the pywatchman sub-project, has
been underwhelming for years. I do not plan to maintain this unofficial release
for a long period of time, but hopefully seeing that it *is* possible to build
and publish a release will trigger some renewed interest.

Use at your own risk.
"""


def srcs(names):
"""transform a list of sources to be relative to py_dir"""
return ["%s/%s" % (py_dir, n) for n in names]


setup(
name="pywatchman",
version="1.4.1",
name="pywatchman-unofficial",
version="1.5.0",
package_dir={"": py_dir},
description="Watchman client for python",
description="Watchman client for python (unofficial)",
author="Wez Furlong, Rain",
author_email="[email protected]",
maintainer="Wez Furlong",
maintainer_email="wez@fb.com",
url="https://github.com/facebook/watchman",
long_description="Connect and query Watchman to discover file changes",
maintainer="Josh Smeaton",
maintainer_email="josh.smeaton@gmail.com",
url="https://github.com/jarshwah/watchman",
long_description=long_description,
keywords=("watchman inotify fsevents kevent kqueue portfs filesystem watcher"),
license="BSD",
packages=["pywatchman"],
Expand Down