#!/usr/bin/env python3
"""
Minimal reproducer for the swigvarlink DeprecationWarning.

This script demonstrates the warning that occurs when importing the selinux module
and accessing SWIG-generated global variables.

NOTE: This warning appears only before the fix is applied. The fix requires:
- Updating SWIG to version 4.4+ (which includes fixes for these warnings)
- Or applying a patch to add __module__ attributes to SWIG-generated types
- Or waiting for an updated libselinux package built with newer SWIG
"""

import warnings

# Enable all warnings to make sure we see the deprecation warning
warnings.simplefilter('always')

print("Reproducing swigvarlink DeprecationWarning...")
print("=" * 50)

# Import the selinux module - this triggers the warning
import selinux

print("SELinux module imported successfully")
print("Warning should have appeared above this line")
print("=" * 50)

# Access some SWIG-generated constants to potentially trigger more warnings
print("Accessing SWIG-generated constants:")
print(f"SELINUX_AVC = {selinux.SELINUX_AVC}")
print(f"DISABLED = {selinux.DISABLED}")
print(f"PERMISSIVE = {selinux.PERMISSIVE}")
print(f"ENFORCING = {selinux.ENFORCING}")

print("=" * 50)
print("Reproducer completed. Check the output above for DeprecationWarning messages.")
print("These warnings will disappear once the SWIG compatibility issue is fixed.")
