%global _empty_manifest_terminate_build 0 Name: python-office365-rest-client Version: 2.2.0 Release: 1 Summary: Office 365 Library for Python License: MIT URL: https://github.com/vgrem/Office365-REST-Python-Client Source0: https://mirrors.nju.edu.cn/pypi/web/packages/11/15/b36f8f9bd569213c80d84135842acd59f834a5eb5d8d210d512fade53bb5/office365-rest-client-2.2.0.tar.gz BuildArch: noarch Requires: python3-requests Requires: python3-adal Requires: python3-requests-ntlm %description # About Office 365 & Microsoft Graph library for Python # Usage 1. [Installation](#Installation) 1. [Working with SharePoint API](#Working-with-SharePoint-API) 2. [Working with Outlook API](#Working-with-Outlook-API) 3. [Working with OneDrive API](#Working-with-OneDrive-API) 4. [Working with Microsoft Teams API](#Working-with-Microsoft-Teams-API) ## Status [![Downloads](https://pepy.tech/badge/office365-rest-python-client)](https://pepy.tech/project/office365-rest-python-client) [![PyPI](https://img.shields.io/pypi/v/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client/) [![Build Status](https://travis-ci.org/vgrem/Office365-REST-Python-Client.svg?branch=master)](https://travis-ci.org/vgrem/Office365-REST-Python-Client) # Installation Use pip: ``` pip install Office365-REST-Python-Client ``` # Working with SharePoint API The list of supported API versions: - [SharePoint 2013 REST API](https://msdn.microsoft.com/en-us/library/office/jj860569.aspx) and above - SharePoint Online & OneDrive for Business REST API #### Authentication The following auth flows are supported: - app principals flow: `AuthenticationContext.ctx_auth.acquire_token_for_app(client_id, client_secret)` (refer [Granting access using SharePoint App-Only](https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs) for a details) - user credentials flow:`AuthenticationContext.ctx_auth.acquire_token_for_user(username, password)` - certificate credentials flow `ClientContext.connect_with_certificate(site_url, client_id,thumbprint, certificate_path)` #### Examples There are **two approaches** available to perform API queries: 1. `ClientContext class` - where you target SharePoint resources such as `Web`, `ListItem` and etc (recommended) ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web ctx.load(web) ctx.execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` or alternatively via method chaining (a.k.a Fluent Interface): ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web.load().execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` 2. `RequestOptions class` - where you construct REST queries (and no model is involved) The example demonstrates how to read `Web` properties: ```python import json from office365.runtime.auth.UserCredential import UserCredential from office365.runtime.http.request_options import RequestOptions from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) request = RequestOptions("{0}/_api/web/".format(site_url)) response = ctx.execute_request_direct(request) json = json.loads(response.content) web_title = json['d']['Title'] print("Web title: {0}".format(web_title)) ``` # Working with Outlook API The list of supported APIs: - [Outlook Contacts REST API](https://msdn.microsoft.com/en-us/office/office365/api/contacts-rest-operations) - [Outlook Calendar REST API](https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations) - [Outlook Mail REST API](https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations) Since Outlook REST APIs are available in both Microsoft Graph and the Outlook API endpoint, the following clients are available: - `GraphClient` which targets Outlook `v2.0` version (*preferable* nowadays, refer [transition to Microsoft Graph-based Outlook REST API](https://docs.microsoft.com/en-us/outlook/rest/compare-graph-outlook) for a details) - `OutlookClient` which targets Outlook `v1.0` version (not recommended for usage since `v1.0` version is being deprecated.) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Example The example demonstrates how to send an email via [Microsoft Graph endpoint](https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http). > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) message_json = { "Message": { "Subject": "Meet for lunch?", "Body": { "ContentType": "Text", "Content": "The new cafeteria is open." }, "ToRecipients": [ { "EmailAddress": { "Address": "jdoe@contoso.onmicrosoft.com" } } ] }, "SaveToSentItems": "false" } login_name = "mdoe@contoso.onmicrosoft.com" client.users[login_name].send_mail(message_json) client.execute_query() ``` # Working with OneDrive API #### Documentation [OneDrive Graph API reference](https://docs.microsoft.com/en-us/graph/api/resources/onedrive?view=graph-rest-1.0) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: list available drives The example demonstrates how to enumerate and print drive's url which corresponds to [`list available drives` endpoint](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_list?view=odsp-graph-online) > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized)""" token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) drives = client.drives client.load(drives) client.execute_query() for drive in drives: print("Drive url: {0}".format(drive.web_url)) ``` ##### Example: download the contents of a DriveItem(folder facet) ```python # retrieve drive properties (source) drive = client.users[user_id_or_principal_name].drive client.load(drive) client.execute_query() # download files from OneDrive into local folder with tempfile.TemporaryDirectory() as path: download_files(drive.root, path) ``` where ```python def download_files(remote_folder, local_path): drive_items = remote_folder.children client.load(drive_items) client.execute_query() for drive_item in drive_items: if not drive_item.file.is_server_object_null: # is file? # download file content with open(os.path.join(local_path, drive_item.name), 'wb') as local_file: drive_item.download(local_file) client.execute_query() ``` Refer [OneDrive examples section](examples/onedrive) for a more examples. # Working with Microsoft Teams API #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: create a new team under a group The example demonstrates how create a new team under a group which corresponds to [`Create team` endpoint](https://docs.microsoft.com/en-us/graph/api/team-put-teams?view=graph-rest-1.0&tabs=http) ```python tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) new_team = client.groups[group_id].add_team() client.execute_query() ``` where ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized) :type auth_ctx: adal.AuthenticationContext """ token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token ``` # Third Party Libraries and Dependencies The following libraries will be installed when you install the client library: * [requests](https://github.com/kennethreitz/requests) * [adal](https://github.com/AzureAD/azure-activedirectory-library-for-python) %package -n python3-office365-rest-client Summary: Office 365 Library for Python Provides: python-office365-rest-client BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-office365-rest-client # About Office 365 & Microsoft Graph library for Python # Usage 1. [Installation](#Installation) 1. [Working with SharePoint API](#Working-with-SharePoint-API) 2. [Working with Outlook API](#Working-with-Outlook-API) 3. [Working with OneDrive API](#Working-with-OneDrive-API) 4. [Working with Microsoft Teams API](#Working-with-Microsoft-Teams-API) ## Status [![Downloads](https://pepy.tech/badge/office365-rest-python-client)](https://pepy.tech/project/office365-rest-python-client) [![PyPI](https://img.shields.io/pypi/v/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client/) [![Build Status](https://travis-ci.org/vgrem/Office365-REST-Python-Client.svg?branch=master)](https://travis-ci.org/vgrem/Office365-REST-Python-Client) # Installation Use pip: ``` pip install Office365-REST-Python-Client ``` # Working with SharePoint API The list of supported API versions: - [SharePoint 2013 REST API](https://msdn.microsoft.com/en-us/library/office/jj860569.aspx) and above - SharePoint Online & OneDrive for Business REST API #### Authentication The following auth flows are supported: - app principals flow: `AuthenticationContext.ctx_auth.acquire_token_for_app(client_id, client_secret)` (refer [Granting access using SharePoint App-Only](https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs) for a details) - user credentials flow:`AuthenticationContext.ctx_auth.acquire_token_for_user(username, password)` - certificate credentials flow `ClientContext.connect_with_certificate(site_url, client_id,thumbprint, certificate_path)` #### Examples There are **two approaches** available to perform API queries: 1. `ClientContext class` - where you target SharePoint resources such as `Web`, `ListItem` and etc (recommended) ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web ctx.load(web) ctx.execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` or alternatively via method chaining (a.k.a Fluent Interface): ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web.load().execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` 2. `RequestOptions class` - where you construct REST queries (and no model is involved) The example demonstrates how to read `Web` properties: ```python import json from office365.runtime.auth.UserCredential import UserCredential from office365.runtime.http.request_options import RequestOptions from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) request = RequestOptions("{0}/_api/web/".format(site_url)) response = ctx.execute_request_direct(request) json = json.loads(response.content) web_title = json['d']['Title'] print("Web title: {0}".format(web_title)) ``` # Working with Outlook API The list of supported APIs: - [Outlook Contacts REST API](https://msdn.microsoft.com/en-us/office/office365/api/contacts-rest-operations) - [Outlook Calendar REST API](https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations) - [Outlook Mail REST API](https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations) Since Outlook REST APIs are available in both Microsoft Graph and the Outlook API endpoint, the following clients are available: - `GraphClient` which targets Outlook `v2.0` version (*preferable* nowadays, refer [transition to Microsoft Graph-based Outlook REST API](https://docs.microsoft.com/en-us/outlook/rest/compare-graph-outlook) for a details) - `OutlookClient` which targets Outlook `v1.0` version (not recommended for usage since `v1.0` version is being deprecated.) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Example The example demonstrates how to send an email via [Microsoft Graph endpoint](https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http). > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) message_json = { "Message": { "Subject": "Meet for lunch?", "Body": { "ContentType": "Text", "Content": "The new cafeteria is open." }, "ToRecipients": [ { "EmailAddress": { "Address": "jdoe@contoso.onmicrosoft.com" } } ] }, "SaveToSentItems": "false" } login_name = "mdoe@contoso.onmicrosoft.com" client.users[login_name].send_mail(message_json) client.execute_query() ``` # Working with OneDrive API #### Documentation [OneDrive Graph API reference](https://docs.microsoft.com/en-us/graph/api/resources/onedrive?view=graph-rest-1.0) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: list available drives The example demonstrates how to enumerate and print drive's url which corresponds to [`list available drives` endpoint](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_list?view=odsp-graph-online) > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized)""" token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) drives = client.drives client.load(drives) client.execute_query() for drive in drives: print("Drive url: {0}".format(drive.web_url)) ``` ##### Example: download the contents of a DriveItem(folder facet) ```python # retrieve drive properties (source) drive = client.users[user_id_or_principal_name].drive client.load(drive) client.execute_query() # download files from OneDrive into local folder with tempfile.TemporaryDirectory() as path: download_files(drive.root, path) ``` where ```python def download_files(remote_folder, local_path): drive_items = remote_folder.children client.load(drive_items) client.execute_query() for drive_item in drive_items: if not drive_item.file.is_server_object_null: # is file? # download file content with open(os.path.join(local_path, drive_item.name), 'wb') as local_file: drive_item.download(local_file) client.execute_query() ``` Refer [OneDrive examples section](examples/onedrive) for a more examples. # Working with Microsoft Teams API #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: create a new team under a group The example demonstrates how create a new team under a group which corresponds to [`Create team` endpoint](https://docs.microsoft.com/en-us/graph/api/team-put-teams?view=graph-rest-1.0&tabs=http) ```python tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) new_team = client.groups[group_id].add_team() client.execute_query() ``` where ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized) :type auth_ctx: adal.AuthenticationContext """ token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token ``` # Third Party Libraries and Dependencies The following libraries will be installed when you install the client library: * [requests](https://github.com/kennethreitz/requests) * [adal](https://github.com/AzureAD/azure-activedirectory-library-for-python) %package help Summary: Development documents and examples for office365-rest-client Provides: python3-office365-rest-client-doc %description help # About Office 365 & Microsoft Graph library for Python # Usage 1. [Installation](#Installation) 1. [Working with SharePoint API](#Working-with-SharePoint-API) 2. [Working with Outlook API](#Working-with-Outlook-API) 3. [Working with OneDrive API](#Working-with-OneDrive-API) 4. [Working with Microsoft Teams API](#Working-with-Microsoft-Teams-API) ## Status [![Downloads](https://pepy.tech/badge/office365-rest-python-client)](https://pepy.tech/project/office365-rest-python-client) [![PyPI](https://img.shields.io/pypi/v/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/Office365-REST-Python-Client.svg)](https://pypi.python.org/pypi/Office365-REST-Python-Client/) [![Build Status](https://travis-ci.org/vgrem/Office365-REST-Python-Client.svg?branch=master)](https://travis-ci.org/vgrem/Office365-REST-Python-Client) # Installation Use pip: ``` pip install Office365-REST-Python-Client ``` # Working with SharePoint API The list of supported API versions: - [SharePoint 2013 REST API](https://msdn.microsoft.com/en-us/library/office/jj860569.aspx) and above - SharePoint Online & OneDrive for Business REST API #### Authentication The following auth flows are supported: - app principals flow: `AuthenticationContext.ctx_auth.acquire_token_for_app(client_id, client_secret)` (refer [Granting access using SharePoint App-Only](https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs) for a details) - user credentials flow:`AuthenticationContext.ctx_auth.acquire_token_for_user(username, password)` - certificate credentials flow `ClientContext.connect_with_certificate(site_url, client_id,thumbprint, certificate_path)` #### Examples There are **two approaches** available to perform API queries: 1. `ClientContext class` - where you target SharePoint resources such as `Web`, `ListItem` and etc (recommended) ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web ctx.load(web) ctx.execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` or alternatively via method chaining (a.k.a Fluent Interface): ```python from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) web = ctx.web.load().execute_query() print("Web title: {0}".format(web.properties['Title'])) ``` 2. `RequestOptions class` - where you construct REST queries (and no model is involved) The example demonstrates how to read `Web` properties: ```python import json from office365.runtime.auth.UserCredential import UserCredential from office365.runtime.http.request_options import RequestOptions from office365.sharepoint.client_context import ClientContext ctx = ClientContext(site_url).with_credentials(UserCredential(username, password)) request = RequestOptions("{0}/_api/web/".format(site_url)) response = ctx.execute_request_direct(request) json = json.loads(response.content) web_title = json['d']['Title'] print("Web title: {0}".format(web_title)) ``` # Working with Outlook API The list of supported APIs: - [Outlook Contacts REST API](https://msdn.microsoft.com/en-us/office/office365/api/contacts-rest-operations) - [Outlook Calendar REST API](https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations) - [Outlook Mail REST API](https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations) Since Outlook REST APIs are available in both Microsoft Graph and the Outlook API endpoint, the following clients are available: - `GraphClient` which targets Outlook `v2.0` version (*preferable* nowadays, refer [transition to Microsoft Graph-based Outlook REST API](https://docs.microsoft.com/en-us/outlook/rest/compare-graph-outlook) for a details) - `OutlookClient` which targets Outlook `v1.0` version (not recommended for usage since `v1.0` version is being deprecated.) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Example The example demonstrates how to send an email via [Microsoft Graph endpoint](https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http). > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) message_json = { "Message": { "Subject": "Meet for lunch?", "Body": { "ContentType": "Text", "Content": "The new cafeteria is open." }, "ToRecipients": [ { "EmailAddress": { "Address": "jdoe@contoso.onmicrosoft.com" } } ] }, "SaveToSentItems": "false" } login_name = "mdoe@contoso.onmicrosoft.com" client.users[login_name].send_mail(message_json) client.execute_query() ``` # Working with OneDrive API #### Documentation [OneDrive Graph API reference](https://docs.microsoft.com/en-us/graph/api/resources/onedrive?view=graph-rest-1.0) #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: list available drives The example demonstrates how to enumerate and print drive's url which corresponds to [`list available drives` endpoint](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_list?view=odsp-graph-online) > Note: access token is getting acquired via [Client Credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized)""" token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) drives = client.drives client.load(drives) client.execute_query() for drive in drives: print("Drive url: {0}".format(drive.web_url)) ``` ##### Example: download the contents of a DriveItem(folder facet) ```python # retrieve drive properties (source) drive = client.users[user_id_or_principal_name].drive client.load(drive) client.execute_query() # download files from OneDrive into local folder with tempfile.TemporaryDirectory() as path: download_files(drive.root, path) ``` where ```python def download_files(remote_folder, local_path): drive_items = remote_folder.children client.load(drive_items) client.execute_query() for drive_item in drive_items: if not drive_item.file.is_server_object_null: # is file? # download file content with open(os.path.join(local_path, drive_item.name), 'wb') as local_file: drive_item.download(local_file) client.execute_query() ``` Refer [OneDrive examples section](examples/onedrive) for a more examples. # Working with Microsoft Teams API #### Authentication [ADAL Python](https://adal-python.readthedocs.io/en/latest/#) library is utilized to authenticate users to Active Directory (AD) and obtain tokens #### Examples ##### Example: create a new team under a group The example demonstrates how create a new team under a group which corresponds to [`Create team` endpoint](https://docs.microsoft.com/en-us/graph/api/team-put-teams?view=graph-rest-1.0&tabs=http) ```python tenant_name = "contoso.onmicrosoft.com" client = GraphClient(tenant_name, get_token) new_team = client.groups[group_id].add_team() client.execute_query() ``` where ```python def get_token(auth_ctx): """Acquire token via client credential flow (ADAL Python library is utilized) :type auth_ctx: adal.AuthenticationContext """ token = auth_ctx.acquire_token_with_client_credentials( "https://graph.microsoft.com", client_id, client_secret) return token ``` # Third Party Libraries and Dependencies The following libraries will be installed when you install the client library: * [requests](https://github.com/kennethreitz/requests) * [adal](https://github.com/AzureAD/azure-activedirectory-library-for-python) %prep %autosetup -n office365-rest-client-2.2.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-office365-rest-client -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 11 2023 Python_Bot - 2.2.0-1 - Package Spec generated