-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 scdoc documentation tool #8598
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.11.12": | ||
url: "https://git.sr.ht/~sircmpwn/scdoc/archive/1.11.2.tar.gz" | ||
sha256: "e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from conans import ConanFile, AutoToolsBuildEnvironment, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
required_conan_version = ">=1.33.0" | ||
|
||
|
||
class ScdocInstallerConan(ConanFile): | ||
name = "scdoc" | ||
description = "scdoc is a simple man page generator for POSIX systems written in C99." | ||
topics = ("manpage", "documentation", "posix") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://git.sr.ht/~sircmpwn/scdoc" | ||
license = "MIT" | ||
settings = "os", "arch", "compiler", "build_type" | ||
_autotools = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def build_requirements(self): | ||
self.build_requires("make/4.3") | ||
|
||
def configure(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, | ||
destination=self._source_subfolder) | ||
|
||
@staticmethod | ||
def _chmod_plus_x(filename): | ||
if os.name == "posix": | ||
os.chmod(filename, os.stat(filename).st_mode | 0o111) | ||
|
||
def _configure_autotools(self): | ||
if self._autotools: | ||
return self._autotools | ||
self._autotools = AutoToolsBuildEnvironment(self) | ||
return self._autotools | ||
|
||
def build(self): | ||
autotools = self._configure_autotools() | ||
with tools.chdir(self._source_subfolder): | ||
autotools.make() | ||
|
||
def package(self): | ||
autotools = self._configure_autotools() | ||
with tools.chdir(self._source_subfolder): | ||
autotools.install(args=[f"PREFIX={self.package_folder}"]) | ||
self.copy(pattern="COPYING", dst="licenses", | ||
src=self._source_subfolder) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libdirs = [] | ||
|
||
scdoc_root = os.path.join(self.package_folder, "bin") | ||
self.output.info( | ||
"Appending PATH environment variable: {}".format(scdoc_root)) | ||
self.env_info.PATH.append(scdoc_root) | ||
self._chmod_plus_x(os.path.join(scdoc_root, "scdoc")) | ||
pkgconfig_variables = { | ||
'exec_prefix': '${prefix}/bin', | ||
'scdoc': '${exec_prefix}/scdoc', | ||
} | ||
self.cpp_info.set_property( | ||
"pkg_config_custom_content", | ||
"\n".join("%s=%s" % (key, value) for key,value in pkgconfig_variables.items())) | ||
|
||
def validate(self): | ||
if self.settings.os in ["Macos", "Windows"]: | ||
raise ConanInvalidConfiguration( | ||
f"Builds aren't supported on {self.settings.os}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from conans import ConanFile, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run( | ||
f"scdoc < {os.path.join(self.source_folder,'test_package.1.scd')}", run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
test_package(1) | ||
|
||
# NAME | ||
|
||
test_package - This is a test package for scdoc | ||
|
||
# DESCRIPTION | ||
|
||
This is a simple scd file for test_package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.11.12": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually do it when packaging, but I think you want to be sure the user will have permission to execute the binary.