Sphinx - How can one share a directory containing many reStructuredText files among multiple Sphinx projects - documentation

I create documentation in Sphinx, my project has the following structure.
---my_project
---client1
---rest_directories_created_by_sphinx
---source
---index.rst
---client2
---rest_directories_and_files_created_by_sphinx
---source
---index.rst
---shared
---file1.rst
---file2.rst
In the future there will be more client folders.
In file client1/source/index.rst I need to put in toctree files from directory shared
When I write
includepath = ['./shared']
I get an Error that toctree in file client1/index.rst contains reference to non existing document.
I have no idea how can i do it?
conf.py is in client1/source and in client2/source.
shared is on the same level as client1 and client2 I want to include in toctree file1.rst and file2.rst from directory shared

Related

How to combine STM32 HAL library with CMake, as it need file from project it linked to [duplicate]

i have recently switched my stm32 project to CMake to be independent on IDE. Root repository (application) contains multiple submodules (HAL, FreeRTOS etc.) and its CMakeLists.txt includes explicitly every single used file:
set(EXECUTABLE ${PROJECT_NAME}.elf)
add_executable(${EXECUTABLE}
# Own sources
src/main.c
src/SEGGER_SYSVIEW_Config_FreeRTOS.c
src/startup_stm32h723zgtx.s
src/stm32h7xx_hal_timebase_tim.c
src/system_stm32h7xx.c
# Base CMSIS and HAL library
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
#long list of HAL c files there...
# FreeRTOS library
lib-freertos/croutine.c
lib-freertos/event_groups.c
lib-freertos/list.c
lib-freertos/queue.c
lib-freertos/stream_buffer.c
lib-freertos/tasks.c
lib-freertos/timers.c
lib-freertos/portable/GCC/ARM_CM7/r0p1/port.c
lib-freertos/trace/Sample/FreeRTOSV10/SEGGER_SYSVIEW_FreeRTOS.c
lib-freertos/trace/SEGGER/Syscalls/SEGGER_RTT_Syscalls_GCC.c
lib-freertos/trace/SEGGER/SEGGER_RTT_ASM_ARMv7M.S
lib-freertos/trace/SEGGER/SEGGER_RTT_printf.c
lib-freertos/trace/SEGGER/SEGGER_RTT.c
lib-freertos/trace/SEGGER/SEGGER_SYSVIEW.c
)
target_include_directories(${EXECUTABLE}
PRIVATE
include
src
lib-hal/stm32h7xx/CMSIS/Include
lib-hal/stm32h7xx/CMSIS/Device/ST/STM32H7xx/Include
lib-hal/stm32h7xx/STM32H7xx_HAL_Driver/Inc
lib-freertos/include
lib-freertos/trace/Config
lib-freertos/trace/SEGGER
lib-freertos/trace/Sample/FreeRTOSV10/
lib-freertos/portable/GCC/ARM_CM7/r0p1
)
This solution works but i know it is not a sustainable approach. So i tried to create library in lib-hal and lib-freertos submodules, specifying their sources and includes
add_library(lib-hal-stm32h7xx)
target_include_directories(lib-hal-stm32h7xx
PUBLIC
CMSIS/Include
CMSIS/Device/ST/STM32H7xx/Include
STM32H7xx_HAL_Driver/Inc
PRIVATE
STM32H7xx_HAL_Driver/Src
)
target_sources(lib-hal-stm32h7xx
PRIVATE
STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c
STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c
STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
#long list of HAL c files there...
)
and then using
add_subdirectory(lib-hal/stm32h7xx)
add_subdirectory(lib-freertos)
and
target_link_library(${EXECUTABLE} lib-freertos lib-hal-stm32h7xx)
to "import" submodules into application project. But when building the executable, gcc cannot access files stm32h7xx_hal_conf.h and FreeRTOSConfig.h which are located in root directory include. I do not want to put configuration headers into submodules because they are used in multiple projects with different configurations. Is it possible to somehow extend already specified directory search scope for library after adding it into parent project?
File structure of project:
-src
-include (configuration for lib-hal and lib-freertos included there)
-lib-hal
-includes...
-sources...
-lib-freertos
-includes...
-sources...
Thanks in advance for response.
As Tsyvarev mentioned in the comments, you can modify the properties of the target in your project. To keep things clean, I usually create a function for this and place it in a separate file.
Tip: you can also add source files to the target. In case of FreeRTOS, you could add architecture-specific files, in case all your projects don't run on the same MCU family.
function(configure_freertos target_name)
target_sources(${target_name}
PRIVATE
lib-freertos/portable/GCC/ARM_CM7/r0p1/port.c
)
target_include_directories(${target_name}
PUBLIC
include
lib-freertos/portable/GCC/ARM_CM7/r0p1
)
endfunction()

Get the current directory status information? [duplicate]

How can I get the status of a single directory, rather than the whole repository?
I have looked at the following:
git_status_list_new which gets the repository status, but I care only about files located in a single directory.
git_status_file which gets the status of a single.
Is there a way that I can get the status of a single directory using libgit2?
git_status_list_new accepts a git_status_options struct, which contains a pathspec member which controls which files will be included in the list. You can use that to limit your returned statuses to those in a single directory.

Shared dropbox folder access programmatically

Is it possible to access publicly shared dropbox folder or file programmatically with out using app key or app secret,just by using url
If it helps someone :
Option to share DropBox folders and access files via URLs by names - with NO NEED TO Share each file
e.g.
STEP 1 : Create a new folder for your images ( or any other files ) in your PUBLIC Dropbox folder
1. Create a folder in PUBLIC folder (e.g. MyTestFolder)
2. Put an image file in this folder (e.g Grupya_whatsApp_logo.jpg)
-
STEP 2 : Get the USERID of your public Dropbox folder ( it is the same USERID also for subfolder within PUBLIC )
3. Copy public link of Image created in step 2 (e.g Grupya_whatsApp_logo.jpg)
4. Please note syntax will be something like :
https://u17835471.dl.dropboxusercontent.com/u/17845471/MyTestFolder/Grupya_whatsApp_logo.jpg
5. You May change URL reference to somthing shorter :
https://dl.dropbox.com/u/17845471/MyTestFolder/Grupya_whatsApp_logo.jpg
-
STEP 3 : Now - You can create any sub folder under PUBLIC folder and reference to it by using Filenames that are in this directory, directly
https://dl.dropbox.com/u/17845471/MyTestFolder/Grupya_whatsApp_logo.jpg
https://dl.dropbox.com/u/17845471/MyTestFolder/BFly.jpg
If you're referring to a Dropbox shared link for the folder, you can download all of the file content as shown here:
https://www.dropbox.com/help/201
For anything else, you'd need to use the API, which does require an API app, e.g.:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file

Unpack a rar file

Okay, so I have searched for dll files that will allow me to unrar files and I was able to find quite a few such as unrar.dll, chilkat, sharpcompress and some more but I wanted to use the one provided by Rar themselves.
So I referenced the DLL file in my project and imported it. I was using unrar.dll.
But I wasn't able to find any up to date code to allow me to test and try things out. All the examples I found were either not up to date or not for Vb.net.
I also tried the official example, which came in the installation but that didn't work even after I fixed it and when I tried to use the code I always got an error for
object reference not set to an instance of an object
I just want to unrar a rar file from a specific location to the root directory of my program so if my program was on the desktop I want it to unrar a file in My documents and extract the files to my desktop.
If you just want to unrar files, I Was able to do that with SharpCompress
First I created a new VB.Net App and added a reference to SharpCompress.dll before using this code to extract all the files from a Rar file.
'Imports
Imports SharpCompress.Archives
Imports SharpCompress.Common
'Unrar code
Dim archive As IArchive = ArchiveFactory.Open("C:\file.rar")
For Each entry In archive.Entries
If Not entry.IsDirectory Then
Console.WriteLine(entry.Key)
entry.WriteToDirectory("C:\unrar", New ExtractionOptions With
{.ExtractFullPath = True, .Overwrite = True})
End If
Next
More code samples
for those who will try in vb.net the extract options are renamed and used as
Dim options As New ExtractionOptions With {
.ExtractFullPath = True,
.Overwrite = True
}
entry.WriteToDirectory(Application.StartupPath, options)

boost build - sources with the same name

src
|--Manager.cpp
|--Specializations
| |--Manager.cpp
Building this Boost.Build tries to create
/bin/...
|--Manager.o
|--Manager.o
but fails. How to resolve this automatically? I read FAQ item, but I don't like the solution, as I have to fix things manually when I have a same class name, but different namespace. Would it be possible to make Boost.Build automatically prefix object file names with directory?
/bin/...
|--Manager.o
|--Specializations.Manager.o
Or duplicate the source directory tree?
/bin/...
|--Manager.o
|--Specializations
| |--Manager.o
This behavior has been changed a long time ago and should just work. Boost.Build now mimics the source structure, i.e. you should get both bin/Manager.o and bin/Specializations/Manager.o.