Skip to content

Commit

Permalink
Restrict Julia compatibility to at least v1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobjpeters committed Aug 10, 2024
1 parent 0e19cff commit 25d1cc5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
version:
- 'pre'
- '1'
- '1.9.0'
- '1.10.0'
os:
- ubuntu-latest
- macOS-latest
Expand All @@ -36,7 +36,7 @@ jobs:
arch: ${{ matrix.arch }}
show-versioninfo: true
- uses: julia-actions/julia-downgrade-compat@v1
if: ${{ matrix.version == '1.7' }}
if: ${{ matrix.version == '1.10' }}
with:
strict: 'true'
- uses: julia-actions/cache@v1
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LaTeXStrings = "1"
Markdown = "1"
PrecompileTools = "1"
Typst_jll = "0.2, 0.3, 0.7, 0.8, 0.10, 0.11"
julia = "1.9"
julia = "1.10"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Documenter = "1"
Luxor = "3 - 4"
MakieTeX = "0.4.1"
TypstJlyfish = "0.1.0"
julia = "1.10"
1 change: 0 additions & 1 deletion docs/source/references/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Typstry.Strings.show_array
Typstry.Strings.show_parameters
Typstry.Strings.show_raw
Typstry.Strings.show_vector
Typstry.Strings.static_parse
```

### Dates.jl
Expand Down
30 changes: 11 additions & 19 deletions src/Commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ module Commands

import Base:
==, addenv, detach, eltype, firstindex, getindex, hash, ignorestatus,
iterate, keys, lastindex, length, run, setenv, show, showerror
iterate, keys, lastindex, length, run, setcpuaffinity, setenv, show, showerror
using ..Typstry: Strings, Typst, TypstString, TypstText, @typst_str
using .Strings: enclose, join_with, _show_typst
using Artifacts: @artifact_str
using Typst_jll: typst

@static isdefined(Base, :setcpuaffinity) && import Base: setcpuaffinity

# Internals

"""
Expand Down Expand Up @@ -402,25 +400,19 @@ function run(tc::TypstCommand, args...; kwargs...)
process
end

@static if isdefined(Base, :setcpuaffinity)
setcpuaffinity(tc::TypstCommand, cpus) = TypstCommand(tc; cpus)

@doc """
setcpuaffinity(::TypstCommand, cpus)
"""
setcpuaffinity(::TypstCommand, cpus)
See also [`TypstCommand`](@ref).
See also [`TypstCommand`](@ref).
!!! compat
Requires at least Julia v0.8.
# Examples
# Examples
```jldoctest
julia> setcpuaffinity(typst`help`, nothing)
typst`help`
```
""" setcpuaffinity
end
```jldoctest
julia> setcpuaffinity(typst`help`, nothing)
typst`help`
```
"""
setcpuaffinity(tc::TypstCommand, cpus) = TypstCommand(tc; cpus)

"""
setenv(::TypstCommand, args...; kwargs...)
Expand Down
13 changes: 2 additions & 11 deletions src/Strings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ macro typst_str(s)
current < previous && push!(args, s[current:prevind(s, previous, interpolate + backslashes ÷ 2)])

if interpolate
x, current = static_parse(s, start; filename, greedy = false)
x, current = parse(s, start; filename, greedy = false)
isexpr(x, :incomplete) && throw(first(x.args))
interpolation = :($TypstString())

append!(interpolation.args, static_parse(s[previous:prevind(s, current)]; filename).args[2:end])
append!(interpolation.args, parse(s[previous:prevind(s, current)]; filename).args[2:end])
push!(args, esc(interpolation))
else current = start
end
Expand Down Expand Up @@ -475,15 +475,6 @@ show_vector(io, x) = math_mode(io, x) do io, x
print(io, "\n", _indent ^ _depth, ")")
end

"""
static_parse(args...; filename, kwargs...)
Call `Meta.parse` with the `filename` if it is supported
in the current Julia version (at least v1.10).
"""
static_parse(args...; filename, kwargs...) = @static VERSION < v"1.10" ?
parse(args...; kwargs...) : parse(args...; filename, kwargs...)

## Dates.jl

"""
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Documenter = "1"
ExplicitImports = "1.6"
MakieTeX = "0.4.1"
TypstJlyfish = "0.1.0"
julia = "1.10"

[extras]
Typstry = "f0ed7684-a786-439e-b1e3-3b82803b501e"
9 changes: 4 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ test_strings(x, s; kwargs...) = @test TypstString(x; kwargs...) == s

@testset "Typstry" begin
for (description, descriptions) in [
"Utilities" => ["ExplicitImports"],
# "Utilities" => ["Aqua", "Documenter", "ExplicitImports"],
# "Interface" => ["Strings", "Commands"],
# "Extensions" => map(string, names),
# "Interoperability" => ["MakieTeX", "TypstJlyfish"]
"Utilities" => ["Aqua", "Documenter", "ExplicitImports"],
"Interface" => ["Strings", "Commands"],
"Extensions" => map(string, names),
"Interoperability" => ["MakieTeX", "TypstJlyfish"]
]
@info "Testing $description"
@testset "$description" begin
Expand Down

0 comments on commit 25d1cc5

Please sign in to comment.