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 compatibility with old macOS versions #733

Merged
merged 4 commits into from Dec 14, 2020

Conversation

CCP-Aporia
Copy link
Contributor

Fix #732

Note that this is mostly untested as I don't have access to old machines and all my local python versions (installed via MacPorts) were configured for Big Sur which makes it impossible to build the extension for an earlier version.

@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 14, 2020

Should we add this code before that line:

]

                # macOS 10.13 is the oldest version supported by Apple.
                '-mmacosx-version-min={}'.format(os.environ.get('MACOSX_DEPLOYMENT_TARGET', '10.13'),

?

Maybe 10.13 is to high for now and we could stick with 10.9 🤔

@CCP-Aporia
Copy link
Contributor Author

CCP-Aporia commented Dec 14, 2020

That's something I tried, but unfortunately it doesn't work with all Python versions on macOS. The versions I have installed via MacPorts have Python compiled with MACOSX_DEPLOYMENT_TARGET=11.0 which causes a compile error when trying to build C extensions with a version lower than 11.0. See this example (added setenv = MACOSX_DEPLOYMENT_TARGET=10.8 to tox.ini):

running build_ext
    building '_watchdog_fsevents' extension
    creating build/temp.macosx-11.0-x86_64-3.9
    creating build/temp.macosx-11.0-x86_64-3.9/src
    /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -DWATCHDOG_VERSION_STRING="1.0.2" -DWATCHDOG_VERSION_MAJOR=1 -DWATCHDOG_VERSION_MINOR=0 -DWATCHDOG_VERSION_BUILD=2 -I/Users/thomas/github.com/CCP-Aporia/watchdog/.tox/py39/include -I/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/watchdog_fsevents.c -o build/temp.macosx-11.0-x86_64-3.9/src/watchdog_fsevents.o -std=c99 -pedantic -Wall -Wextra -fPIC -Wno-nullability-completeness -Wno-nullability-extension -Wno-newline-eof -Wno-error=unused-command-line-argument
    error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.8" but "11.0" during configure

@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 14, 2020

Well it seems safer to not alter that part of the code then :)

@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 14, 2020

Could you add the changelog entry please? I will merge right after.

@BoboTiG BoboTiG merged commit 1d7cb5d into gorakhargosh:master Dec 14, 2020
@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 14, 2020

Thanks a lot @CCP-Aporia :)

BoboTiG added a commit that referenced this pull request Feb 5, 2021
* Fix installation of Python 3.7.9 on Windows (#705)

* [windows] winapi.BUFFER_SIZE now defaults to 64000 (instead of 2048)

To handle cases with lot of changes, this seems the highest safest value we can use.

Note: it will fail with `ERROR_INVALID_PARAMETER` when it is greater than 64 KB and
      the application is monitoring a directory over the network.
      This is due to a packet size limitation with the underlying file sharing protocols.
      https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw#remarks

Also introduced `winapi.PATH_BUFFER_SIZE` (defaults to `2048`)
to keep the old behavior with path-realted functions.

* [mac] Regression fixes for native fsevents (#717)

* [mac] Fix missing event_id attribute in fsevents (#722)

* [mac] Return byte paths if a byte path was given in fsevents (#726)

* Pin py.test to a version that supports 2.7

* Disable pypy2 tests on Windows

They hang and timeout after 6 hours for some unknown reason

* [mac] Add compatibility with old macOS versions (#733)

* Ensure version macros are available

* Uniformize event for deletion of watched dir (#727)

* [inotify] Add support for the IN_CLOSE_WRITE event (#747)

* [mac] Support coalesced fsevents (#734)

* Add `is_coalesced` property to `NativeEvent`

So that we can effectively decide if we need to perform additional
system calls to figure out what really happened.

* Replace `NativeEvent._event_type` with `repr()` support

It's more pythonic, and the `_event_type` implementation wasn't quite
usable anyway.

NB: the representation is not truly copy/paste python code if there is
a double quote inside event.path, but that should be a rare case so we
don't add the expensive special case handling there.

* Allow running tests with debugger attached

Some Python debuggers create additional threads, so we shouldn't assume that there is only one.

* Request notifications for watched root

* Expect events on macOS instead of using `time.sleep()`

It might be even better to check for the emitter class, as opposed to platform

* Add exception handling to FSEventsEmitter

Reduce the amount of 'silent breakage'

* Use sentinel event when setting up tests on macOS

So that we can avoid a race between test setup and fseventsd

* Improve handling of coalesced events

* Revert accidental platform check change

* Fix renaming_top_level_directory test on macOS

* Generate sub events for move operations

* Remove `filesystem_view` again

While the `filesystem_view` helps with filtering out additional
`FileCreatedEvent`+`DirModifiedEvent` pairs then it also introduces
a huge amount of edge cases for synthetic events caused by move and
rename operations. On top of that, in order to properly resolve
those edge cases we'd have to go back to a solution very similar to
the old directory snapshots, with all the performance penalties they
suffered from...

As such I think it's better to acknowledge the behaviour for coalesced
events instead, and thus remove the `filesystem_view` again.

* [mac] Improve handling of rename events (#750)

* drop support for macOS 10.12 and lower

Co-authored-by: SamSchott <ss2151@cam.ac.uk>
Co-authored-by: Boris Staletic <boris.staletic@gmail.com>
Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: ysard <ysard@users.noreply.github.com>
Co-authored-by: Lukas Šupienis <l.supienis@ncs.lt>
Co-authored-by: Lukas Šupienis <lukas.supienis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.0.1 fails to build on macosx-10.9-x86_64-3.8 due to kFSEventStreamEventFlagItemCloned
2 participants