Skip to content

Commit 940597e

Browse files
authored
FEAT: Linux SUSE Support (#210)
### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below (e.g. AB#37452) For external contributors: Insert Github Issue number below (e.g. #149) Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > [AB#34984](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/34984) <!-- External contributors: GitHub Issue --> > GitHub Issue: #<ISSUE_NUMBER> ------------------------------------------------------------------- ### Summary <!-- Insert your summary of changes below. Minimum 10 characters required. --> This pull request adds support for SUSE and openSUSE Linux distributions to the project, updating both documentation and code to correctly detect and handle these platforms. It also clarifies and expands the supported platforms list, and ensures the correct driver paths are selected for SUSE in both C++ and Python code. **Platform support and documentation updates:** * Added SUSE/openSUSE installation instructions and updated the supported platforms list in `README.md`, removing the previous note about pending SUSE support. * Expanded the directory structure documentation in `mssql_python/pybind/README.md` to include SUSE and Alpine builds for both x86_64 and ARM64 architectures, and listed required libraries for these platforms. [[1]](diffhunk://#diff-1429930017ef4a5b84d9331206c1ac47e546427b914986e531e3f04e45f4bb31L102-R108) [[2]](diffhunk://#diff-1429930017ef4a5b84d9331206c1ac47e546427b914986e531e3f04e45f4bb31R161-R176) **Driver path selection logic:** * Updated `GetDriverPathCpp` in `ddbc_bindings.cpp` to detect SUSE/openSUSE via `/etc/SuSE-release` or `/etc/SUSE-brand` and select the correct driver path. * Improved Linux distribution detection in `test_000_dependencies.py` to recognize SUSE/openSUSE and assign the appropriate driver path, with clearer default handling for other distributions. [[1]](diffhunk://#diff-e489a2a29f29954dcd0b17a34b15e53ee2aa4fa1def0a5a466bcee81df59ddf0L61-R69) [[2]](diffhunk://#diff-e489a2a29f29954dcd0b17a34b15e53ee2aa4fa1def0a5a466bcee81df59ddf0R82-R85) <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) ### Contribution Guidelines External contributors: - Create a GitHub issue first: https://github.com/microsoft/mssql-python/issues/new - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary -->
1 parent 7ec0e7d commit 940597e

File tree

7 files changed

+33
-6
lines changed

7 files changed

+33
-6
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,19 @@ dnf install -y libtool-ltdl krb5-libs
3535
# For SUSE
3636
zypper install -y libltdl7 libkrb5-3 libgssapi-krb5-2
3737

38+
# For SUSE/openSUSE
39+
zypper install -y libltdl7
40+
3841
pip install mssql-python
3942
```
4043

4144
## Key Features
4245
### Supported Platforms
4346

44-
Windows, MacOS and Linux (manylinux - Debian, Ubuntu, RHEL & musllinux - Alpine)
47+
Windows, MacOS and Linux (manylinux - Debian, Ubuntu, RHEL, SUSE (x64 only) & musllinux - Alpine)
4548

4649
> **Note:**
47-
> Support for additional Linux OSs (SUSE Linux) will come soon
48-
>
50+
> SUSE Linux ARM64 is not supported by Microsoft ODBC Driver. Use x64 architecture for SUSE deployments.
4951
5052
### DBAPI v2.0 Compliance
5153

2.01 MB
Binary file not shown.
74 KB
Binary file not shown.
Binary file not shown.

mssql_python/pybind/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ mssql_python/
9999
│ ├── debian_ubuntu/
100100
│ │ ├── x86_64/lib/
101101
│ │ └── arm64/lib/
102-
│ └── rhel/
102+
│ ├── rhel/
103+
│ │ ├── x86_64/lib/
104+
│ │ └── arm64/lib/
105+
│ ├── suse/
106+
│ │ └── x86_64/lib/ # ARM64 not supported by Microsoft
107+
│ └── alpine/
103108
│ ├── x86_64/lib/
104109
│ └── arm64/lib/
105110
└── ddbc_bindings.cp{python_version}-{architecture}.{extension}
@@ -152,6 +157,20 @@ Linux builds support multiple distributions:
152157
- `libmsodbcsql-18.5.so.1.1` - Main driver
153158
- `libodbcinst.so.2` - Installer library
154159

160+
**SUSE/openSUSE x86_64:**
161+
- `libmsodbcsql-18.5.so.1.1` - Main driver
162+
- `libodbcinst.so.2` - Installer library
163+
164+
> **Note:** SUSE/openSUSE ARM64 is not supported by Microsoft ODBC Driver 18
165+
166+
**Alpine x86_64:**
167+
- `libmsodbcsql-18.5.so.1.1` - Main driver
168+
- `libodbcinst.so.2` - Installer library
169+
170+
**Alpine ARM64:**
171+
- `libmsodbcsql-18.5.so.1.1` - Main driver
172+
- `libodbcinst.so.2` - Installer library
173+
155174
## **Python Extension Modules**
156175
Your build system generates architecture-specific Python extension modules:
157176

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,10 @@ std::string GetDriverPathCpp(const std::string& moduleDir) {
653653
platform = "alpine";
654654
} else if (fs::exists("/etc/redhat-release") || fs::exists("/etc/centos-release")) {
655655
platform = "rhel";
656+
} else if (fs::exists("/etc/SuSE-release") || fs::exists("/etc/SUSE-brand")) {
657+
platform = "suse";
656658
} else {
657-
platform = "debian_ubuntu";
659+
platform = "debian_ubuntu"; // Default to debian_ubuntu for other distros
658660
}
659661

660662
fs::path driverPath = basePath / "libs" / "linux" / platform / arch / "lib" / "libmsodbcsql-18.5.so.1.1";

tests/test_000_dependencies.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def _detect_linux_distro(self):
6565
platform = "alpine";
6666
} else if (fs::exists("/etc/redhat-release") || fs::exists("/etc/centos-release")) {
6767
platform = "rhel";
68+
} else if (fs::exists("/etc/SuSE-release") || fs::exists("/etc/SUSE-brand")) {
69+
platform = "suse";
6870
} else {
69-
platform = "ubuntu";
71+
platform = "debian_ubuntu";
7072
}
7173
7274
fs::path driverPath = basePath / "libs" / "linux" / platform / arch / "lib" / "libmsodbcsql-18.5.so.1.1";
@@ -77,6 +79,8 @@ def _detect_linux_distro(self):
7779
distro_name = "alpine"
7880
elif (Path("/etc/redhat-release").exists() or Path("/etc/centos-release").exists()):
7981
distro_name = "rhel"
82+
elif (Path("/etc/SuSE-release").exists() or Path("/etc/SUSE-brand").exists()):
83+
distro_name = "suse"
8084
else:
8185
distro_name = "debian_ubuntu"
8286
except Exception:

0 commit comments

Comments
 (0)